The homeostasis of magnesium (Mg(2+)), an abundant divalent cation indispensable for many biological processes including mitochondrial functions, is underexplored. In yeast, the mitochondrial Mg(2+) homeostasis is accurately controlled through the combined effects of importers, Mrs2 and Lpe10, and an exporter, Mme1. However, little is known about this Mg(2+) homeostatic process in multicellular organisms. Here, we identified the first mitochondrial Mg(2+) transporter in Drosophila, the orthologue of yeast Mme1, dMme1, by homologous comparison and functional complementation. dMme1 can mediate the exportation of mitochondrial Mg(2+) when heterologously expressed in yeast. Altering the expression of dMme1, although only resulting in about a 10% change in mitochondrial Mg(2+) levels in either direction, led to a significant survival reduction in Drosophila. Furthermore, the reduced survival resulting from dMme1 expression changes could be completely rescued by feeding the dMME1-RNAi flies Mg(2+)-restricted food or the dMME1-over-expressing flies the Mg(2+)-supplemented diet. Our studies therefore identified the first Drosophila mitochondrial Mg(2+) exporter, which is involved in the precise control of mitochondrial Mg(2+) homeostasis to ensure an optimal state for survival.