Magnesium is an essential mineral in the diet and the second most common intracellular cation in the body. It also serves as a cofactor for over 600 enzymes. First of all, magnesium is necessary for energy production, carbohydrate metabolism and DNA and protein synthesis.