Except in the case of a minor spasm while exercising, hold the stretching until after the acute phase. Avoid heat for the first 48 hours. Vitamin B-complex has been shown of use for leg cramps in one study. Quinine is also helpful but has side effects. Tonic water is a good source of quinine.
Dehydration is a major cause of muscle spasms.
Drink plenty of caffiene free and alcohol free liquids. Drinking 8 glasses per day is nonsence for intensive exercisers. You can lose 8 glasses of fluid in one hour of exercise. Drink until your urine is light yellow. Adapted from the pages of Running Dialogue.