Ammonia (NH3) is essential for modern agriculture and industry and is a potential energy carrier. NH3 is traditionally synthesized by the Haber–Bosch process at high temperature and pressure. The high-energy input of this process has motivated research into electrochemical NH3 synthesis via nitrogen (N2)–water reactions under ambient conditions. However, the future of this low-cost process is compromised by the low yield rate and poor selectivity, ascribed to the inert N≡N bond and ultralow solubility of N2. Obtaining NH3 directly from non-N2 sources could circumvent these challenges. Here we report the eight-electron direct electroreduction of nitrate to NH3 catalysed by copper-incorporated crystalline 3,4,9,10-perylenetetracarboxylic dianhydride. The catalyst exhibits an NH3 production rate of 436 ± 85 μg h−1 cm−2 and a maximum Faradaic efficiency of 85.9% at −0.4 V versus a reversible hydrogen electrode. This notable performance is achieved by the catalyst regulating the transfer of protons and/or electrons to the copper centres and suppressing hydrogen production.