Many dsDNA viruses encode DNA-packaging terminases, each containing a nuclease domain that resolves concatemeric DNA into genome-length units. Terminase nucleases resemble the RNase H-superfamily nucleotidyltransferases in folds, and share a two-metal-ion catalytic mechanism. Here we show that residue K428 of a bacteriophage terminase gp2 nuclease domain mediates binding of the metal cofactor Mg2+. A K428A mutation allows visualization, at high resolution, of a metal ion binding mode with a coupled-octahedral configuration at the active site, exhibiting an unusually short metal-metal distance of 2.42 A° . Such proximity of the two metal ions may play an essential role in catalysis by generating a highly positive electrostatic niche to enable formation of the negatively charged pentacovalent phosphate transition state, and provides the structural basis for distinguishing Mg2+ from Ca2+. Using a metal ion chelator -thujaplicinol as a molecular probe, we observed a second mode of metal ion binding at the active site, mimicking the DNA binding state. Arrangement of the active site residues differs drastically from those in RNase H-like nucleases, suggesting a drifting of the active site configuration during evolution. The two distinct metal ion binding modes unveiledmechanistic details of the two-metalion catalysis at atomic resolution.