Transcellular Mg(2+) transport across epithelia, involving both apical entry and basolateral extrusion, is essential for magnesium homeostasis, but molecules involved in basolateral extrusion have not yet been identified. Here, we show that CNNM4 is the basolaterally located Mg(2+) extrusion molecule. CNNM4 is strongly expressed in intestinal epithelia and localizes to their basolateral membrane. CNNM4-knockout mice showed hypomagnesemia due to the intestinal malabsorption of magnesium, suggesting its role in Mg(2+) extrusion to the inner parts of body. Imaging analyses revealed that CNNM4 can extrude Mg(2+) by exchanging intracellular Mg(2+) with extracellular Na(+). Furthermore, CNNM4 mutations cause Jalili syndrome, characterized by recessive amelogenesis imperfecta with cone-rod dystrophy. CNNM4-knockout mice showed defective amelogenesis, and CNNM4 again localizes to the basolateral membrane of ameloblasts, the enamel-forming epithelial cells. Missense point mutations associated with the disease abolish the Mg(2+) extrusion activity. These results demonstrate the crucial importance of Mg(2+) extrusion by CNNM4 in organismal and topical regulation of magnesium.