Synthetic nitrogen fertilizer such as urea has been key to increasing crop productivity and feeding a growing population. However, the conventional urea production relies on energy-intensive processes, consuming approximately 2% of annual global energy. Here, we report on a more-sustainable electrocatalytic approach that allows for direct and selective synthesis of urea from nitrate and carbon dioxide with an indium hydroxide catalyst at ambient conditions. Remarkably, Faradaic efficiency, nitrogen selectivity and carbon selectivity reach 53.4%, 82.9% and ~100%, respectively. The engineered surface semiconducting behaviour of the catalyst is found to suppress hydrogen evolution reaction. The key step of C–N coupling initiates through the reaction between *NO2 and *CO2 intermediates owing to the low energy barrier on {100} facets. This work suggests an appealing route of urea production and provides deep insight into the underlying chemistry of C–N coupling reaction that could guide sustainable synthesis of other indispensable chemicals.