Despite the importance of Mg(2+) for numerous cellular activities, the mechanisms underlying its import and homeostasis are poorly understood. The CorA family is ubiquitous and is primarily responsible for Mg(2+) transport. However, the key questions-such as, the ion selectivity, the transport pathway, and the gating mechanism-have remained unanswered for this protein family. We present a 3.2 Å resolution structure of the archaeal CorA from Methanocaldococcus jannaschii, which is a unique complete structure of a CorA protein and reveals the organization of the selectivity filter, which is composed of the signature motif of this family. The structure reveals that polar residues facing the channel coordinate a partially hydrated Mg(2+) during the transport. Based on these findings, we propose a unique gating mechanism involving a helical turn upon the binding of Mg(2+) to the regulatory intracellular binding sites, and thus converting a polar ion passage into a narrow hydrophobic pore. Because the amino acids involved in the uptake, transport, and gating are all conserved within the entire CorA family, we believe this mechanism is general for the whole family including the eukaryotic homologs.