From what I have heard, muscle spasms are more likely to occur when one has a magnesium deficiency. Good sources include spinach, salad greens (e.g. chard), pumpkin seeds, beans, salmon, halibut, soybeans, and sesame seeds. I had some back muscle spasms last summer that were quite annoying if not painful. However, I don't typically get spasms. They seemed to go away on their own. I did consume some magnesium-rich foods after the spasms occurred. However, I typically eat plenty of magnesium-rich foods so I'm not so sure that my spasms were necessarily the result of a lack of magnesium. So, you can take that for what you will. But if you aren't getting enough magnesium in your diet already, I suggest getting more into your diet.