Characterized as an uncontrolled muscular contraction often observed as a twitching feeling, muscle spasms can range from being slightly painful to not painful at all (typically viewed more of an annoyance). Muscle spasm causes can be caused by lack of stretching or muscular warm up, muscle fatigue, hot ambient temperatures, dehydration, or micronutrient imbalance.
Muscle spasms typically go away on their own after a few minutes. They may return multiple times prior to going away for good. The best way to prevent muscle spasms is to properly stretch and warm up before exercise, stay hydrated, and try not to exercise when it is exceedingly hot.