Magnesium reduces anxiety and relaxes muscles. Because it's involved in energy production as well as muscle relaxation, it's able to energise and calm at the same time.
Chronic stress depletes your body of magnesium. Under conditions of mental or physical stress, magnesium is released from your cells, enters the blood, and is then excreted via the urine. The more stressed you are, the more magnesium you lose. The lower your magnesium level to begin with, the more reactive to stress you become, and the greater the loss of magnesium from cells. Increasing your intake of magnesium through diet and supplements breaks this vicious cycle by raising blood magnesium levels and helping you deal better with stress.
Another reason you run low on magnesium when you're stressed is because magnesium, along with calcium, is involved in nerve transmission and muscle function. In general, calcium is involved in muscle contraction, and magnesium in muscle relaxation. If you've got a lot of muscle tension from stress, you'll be using up both of these minerals at a faster rate than normal. You won't run out of calcium in a hurry, as you've got a whole skeleton full of it, but you can and probably will run low on magnesium. This will make it difficult for your muscles to relax, leaving you tense, anxious, irritable and more stressed than ever.
The relaxing effect of magnesium makes it extremely useful for those suffering insomnia. If you tend to wake in the night and can't get back to sleep easily, magnesium is certainly worth a try. Supplementing magnesium in the evening is proven to help insomnia.
In addition to the above, magnesium strengthens bones and teeth by making sure calcium is properly used, and there is a growing body of evidence that magnesium in the diet is just as important as calcium for the prevention of osteoporosis. It can also relieve PMS - especially cramping - and improve your energy levels, lower your blood pressure and reduce your risk of heart disease.