Electrochemical nitrogen fixation provides a sustainable alternative to the Haber-Bosch technique. Herein, nanoporous AuCu alloys are fabricated with more active sites and accessible channels, which promote N2 absorbability and activation. Our catalyst displays superior efficiency of 45.7%, ammonia yield of 25.7 μg h-1 cm-2 and selectivity of 98%, overcoming solid Au and Cu nanoparticles.