Nitrate (NO3-) in wastewater poses a serious threat to human health and the ecological environment. The electrocatalytic NO3- reduction to ammonia (NH3) reaction (NO3-RR) emerges as a promising carbon-free energy route for enabling NO3- removal and sustainable NH3 synthesis. However, it remains a challenge to achieve high Faraday efficiencies at a wide potential window due to the complex multiple-electron reduction process. Herein, spatially separated dual-metal tandem electrocatalysts made of a nitrogen-doped ordered mesoporous carbon support with ultrasmall and high-content Cu nanoparticles encapsulated inside and large and low-content Ru nanoparticles dispersed on the external surface (denoted as Ru/Cu@NOMC) are designed. In electrocatalytic NO3-RR, the Cu sites can quickly convert NO3- to adsorbed NO2- (*NO2-), while the Ru sites can efficiently produce active hydrogen (*H) to enhance the kinetics of converting *NO2- to NH3 on the Cu sites. Due to the synergistic effect between the Cu and Ru sites, Ru/Cu@NOMC exhibits a maximum NH3 Faradaic efficiency (FENH3) of approximately 100% at -0.1 V vs reversible hydrogen electrode (RHE) and a high NH3 yield rate of 1267 mmol gcat-1 h-1 at -0.5 V vs RHE. Finite element method (FEM) simulation and electrochemical in situ Raman spectroscopy revealed that the mesoporous framework can enhance the intermediate concentration due to the in situ confinement effect. Thanks to the Cu-Ru synergistic effect and the mesopore confinement effect, a wide potential window of approximately 500 mV for FENH3 over 90% and a superior stability for NH3 production over 156 h can be achieved on the Ru/Cu@NOMC catalyst.