In industry, production of ammonia mainly relies on the intensive Haber-Bosch process, but it consumes high energy with low efficiency and generates a large number of green-house gases. Electrocatalytic nitrogen reduction reaction (ENRR), as an alternative method for fixing N2 under ambient conditions, provides a feasible strategy for sustainable development of N2 cycle storage and utilization of renewable energy. However, traditional nanocatalysts exhibit extremely poor ENRR performance due to low activity of the solid structure and intense hydrogen evolution reactions of single component. Herein, we design and prepare porous gold–palladium nanoalloys (pAuPdNs), which effectively enhance ENRR by the excellent catalytic activity of Au and the significant N2 fixation ability of Pd, as well as the nanoporous structure and synergistic effect between alloy components. The electrochemical results show the NH3 yield of the catalyst is as high as 43.6 μg·h−1·cm−2, and Faradaic efficiency reaches 43.8%, which are superior to the performances of most reported water-based ENRR electrocatalysts. Besides, the selectivity of 95% and stability also exhibit enhancement than numerous reported researches. As compared with solid alloy and porous Au or Pd structures, the superiority of pAuPdNs states the influence of alloying and porous structure. Hence pAuPdNs are proved to be the efficient, stable, and promising electrocatalysts for N2 reduction reaction at ambient temperature and atmospheric pressure.