Muscle spasms (muscle cramps) are painful contractions and tightening of your muscles. They’re common, involuntary and unpredictable. Although there are steps you can take to prevent a muscle spasm and treat it when it attacks, those methods aren’t always dependable. Muscle relaxants, stretching and massage are most likely to help.