Using density functional theory calculations, we investigated the structural, energetic, electronic, and optical properties of recently synthesized duplex DNA containing metal-mediated base pairs. The studied duplex DNA consists of three imidazole (Im) units linked through metal (Im-M-Im, M = metal) and four flanking A:T base pairs (two on each side). We examined the role of artificial base pairing in the presence of two distinctive metal ions, diamagnetic Ag(+) and magnetic Cu(2+) ions, on the stability of duplex DNA. We found that metal-mediated base pairs form stable duplex DNA by direct metal ion coordination to the Im bases. Our results suggest a higher binding stability of base pairing mediated by Cu(2+) ions than by Ag(+) ions, which is attributed to a larger extent of orbital hybridization. We furthermore found that DNA modified with Im-Ag(+)-Im shows the low-energy optical absorption characteristic of π-π*orbital transition of WC A:T base pairs. On the other hand, we found that the low-energy optical absorption peaks for DNA modified with Im-Cu(2+)-Im originate from spin-spin interactions. Additionally, this complex exhibits weak ferromagnetic coupling between Cu(2+) ions and strong spin polarization, which could be used for memory devices. Moreover, analyzing the role of counter ions (Na(+)) and the presence of explicit water molecules on the structural stability and electronic properties of the DNA duplex modified with Im-Ag(+)-Im, we found that the impact of these two factors is negligible. Our results are fruitful for understanding the experimental data and suggest a potential route for constructing effective metal-mediated base pairs in duplex DNA for optoelectronic applications.