Most natural diamonds are formed in Earth's lithospheric mantle; however, the exact mechanisms behind their genesis remain debated. Given the occurrence of electrochemical processes in Earth's mantle and the high electrical conductivity of mantle melts and fluids, we have developed a model whereby localized electric fields play a central role in diamond formation. Here, we experimentally demonstrate a diamond crystallization mechanism that operates under lithospheric mantle pressure-temperature conditions (6.3 and 7.5 gigapascals; 1300° to 1600°C) through the action of an electric potential applied across carbonate or carbonate-silicate melts. In this process, the carbonate-rich melt acts as both the carbon source and the crystallization medium for diamond, which forms in assemblage with mantle minerals near the cathode. Our results clearly demonstrate that electric fields should be considered a key additional factor influencing diamond crystallization, mantle mineral-forming processes, carbon isotope fractionation, and the global carbon cycle.