In the same way we use aspirin to reduce the fever but take antibiotics to treat the infection, we might take muscle relaxants to address the spasms but need to use anti-inflammatories to reduce the inflammation. It may not seem very efficient, and it certainly can be painful, but pain, like fever, is an effective warning signal. For example, an athlete can change his training regimen or overextend himself, which could lead to a muscle or ligament strain and subsequent spasm. At the other end of the spectrum, you may be on a long airplane flight in a cramped, uncomfortable seat and your muscles could be forced into an unfamiliar position. Once you stand up, those strained muscles can trigger a spasm.
Stress can also be a contributing factor.
When you are stressed, you're often unconsciously clenching your shoulders or teeth. This is counterproductive to the normal motion of the joint. The joint is in a position like that of the airline seat and the results, unfortunately, can be similar. So you must address the inflammation of the spine. We treat back spasms with rest, ice, anti-inflammatory medications and specifically designed exercises that can help strengthen the support of the injured joint.