Pain and muscle spasms are common responses to injury. Tendons and ligaments are tissues that connect muscles and bones to each other and to other tissues. The basic building material of muscles, tendons, and ligaments is a protein called collagen. Under normal conditions, collagen acts like a rubber band: It stretches when tension is applied (as when we pull a rubber band) and returns to its normal length when the tension is released. However, when the collagen is stretched too far, it tears. In this tearing process, blood vessels are torn and blood cells and fluid escape into the spaces among the muscle fibers. This is sometimes visible on the surface of the skin as a swollen, bruised area.
Cold applied to the area decreases the flow of this fluid into the tissues and slows the release of chemicals that cause pain and inflammation. Cold decreases feeling in an area by reducing the ability of the nerve endings to conduct impulses. It may also reduce pain by "countering" the injury. For example, you might counter the pain of a sore tooth by pinching yourself hard in the leg.
Cold also decreases the activity of cells to reduce swelling and internal bleeding at the site of acute injury. Cooling the deep tissue also reduces muscle spasm by reducing the muscle's ability to maintain a contraction (contractility).
Because cold reduces bleeding and swelling within injured tissue, it is best used in the first 48 hours after an injury and usually longer after a surgery.