Magnesium 2+ ions bind to (they don’t REALLY bind) and stabilize ATP molecules. The ATP (also ADP and AMP) contain highly reactive phosphates (the energy is stored in the chemical bonds between the phosphates) so Mg2+ ions interact with the lone electron pairs on the oxygens to make the molecule stable and therefore able to perform in biochemical reactions. What is commonly referred to as ATP is actually Mg-ATP.