If there has been an injury or strain, it is important to prevent recurrence by avoiding the activity that caused the problem. Bed rest is sometimes essential if the pain is severe, at least until you can resume normal movement.
Some studies suggest that too much bed rest (usually not more than two days) is counterproductive, and that continuing normal activities within the limits allowed by the pain leads to a more rapid recovery.
As with many muscular injuries, a cold compress, such as a bag of ice, should be applied to the tender spot several times a day, up to 20 minutes each time. After about 48 hours, heat is recommended. Warm baths may also help relax the muscles.
If the pain does not diminish and movement remains restricted, a visit to the doctor is recommended.