Objective: Magnesium regulates a large number of cellular processes. Small changes in intracellular free Mg2+ ([Mg2+](i)) may have important effects on cardiac excitability and contractility. We investigated the effects of [Mg2+](i) on cardiac excitation-contraction coupling. Methods: We used our ionic-metabolic model that incorporates equations for Ca2+ and Mg2+ buffering and transport by ATP and ADP and equations for MgATP regulation of ion transporters (Na+-K+ pump, sarcolemmal and sarcoplasmic Ca2+ pumps). Results: Model results indicate that variations in cytosolic Mg2+ level might sensitively affect diastolic and systolic Ca2+, sarcoplasmic Ca2+ content, Ca2+ influx through L-type channels, efficiency of the Na+/Ca2+ exchanger and action potential shape. The analysis suggests that the most important reason for the observed effects is a modified normal function of sarcoplasmic Ca2+-ATPase pump by altered diastolic MgATP levels. Conclusion: The model is able to reproduce qualitatively a sequence of events that correspond well with experimental observations during cardiac excitation-contraction coupling in mammalian ventricular myocytes.