According to the U.S. National Library of Medicine and the U.S. National Institutes of Health, a muscle spasm or cramp is an involuntary, and often painful, contraction of a muscle or group of muscles. The NIH states that muscle spasms are common, may be alleviated by stretching the affected muscle and that the cramping muscle may feel hard or bulging. Common causes of muscle spasms include dehydration, heavy exercise and certain medical conditions.
Dehydration
According to the MayoClinic.com, mild to moderate dehydration can cause muscle weakness. It may also cause muscle spasms. Dehydration occurs when a person experiences a net fluid loss and the body has inadequate fluids to carry out its normal processes. Failing to replenish fluids, along with salts and electrolytes, especially during hot weather or exercise participation, can negatively impact health, and is potentially fatal. Common causes of dehydration include fever, excessive sweating, vomiting and diarrhea. Those most at risk for dehydration include children, the elderly and people with chronic illnesses. Muscle spasms and cramps are more common during exercise or activity in hot weather because electrolytes--potassium, magnesium and calcium--lost through excessive sweating drop to below normal levels. Muscle spasms indicate that insufficient levels of fluid and electrolytes are present in the body.
Heavy Exercise & Injury
Heavy exercise is a common cause of muscle spasm. According to the Columbia University Medical Center, muscle spasms typically occur from overusing muscles or from an injury. The Sports Injury Bulletin website states that back muscle spasms, in particular, are among the most common athletic injuries, and that, although back spasms are simply involuntary, intermittent and occasionally prolonged muscle contractions, they can be both painful and debilitating. Back and other muscle spasms typically arise after musculoskeletal injuries, as a response to damage in the involved area, joint or segment. Muscles spasms may be the body's mechanism to protect and immobilize the injured segment to prevent further damage. Muscle spasms may also be caused by overuse or chronic muscular exertion without sufficient recovery, which is especially common in people who have engaged in vigorous physical activity after a prolonged period of sedentary living.
Medical Conditions
According to the Cure Research website, some of the medical conditions that can cause muscle spasms as a symptom include tics, twitches, seizures--which is a full body muscle spasm--convulsions, chorea, myoclonus, tremors and trembling, among others.
The Encyclopedia of Children's Health website states that both metabolic disorders and myotonias can cause muscle spasms. Metabolic disorders causing muscle spasm are inherited diseases in which there are a deficiency of specific muscle enzymes. Muscle spasms associated with metabolic disorders occur when a person lacks sufficient myophosphorylase, phosphorylase b kinase, phosphofructokinase, phosphoglycerate kinase, and lactate dehydrogenase.
Myotonias are muscle-related conditions that cause stiffness due to the delayed relaxation of the muscles following contractions, although they do not exhibit the spontaneous muscle contractions typically associated with cramps. Examples of myotonias include myotonic dystrophy, myotonia congenita, paramyotonia congenita, and neuromyotonia.


