3D Ni–Mo electrocatalysts with well-controlled composition, dimensions and nanoporosity are fabricated using a facile and effective electrodeposition technique on Cu foam. These catalysts exhibit enhanced stability and activity for the hydrogen evolution reaction (HER). By optimizing the Ni/Mo ratio, electrodeposition current density, and reaction time, the overpotential for the HER is reduced to 10 mV. The ultrahigh activity and stability of these catalysts are the highest among non-precious-metal electrocatalysts previously reported. The optimized Ni–Mo electrocatalyst has similar overpotential and a much higher current density compared to Pt/C. The improved HER performance is attributed to the Ni/Mo ratio (4:1), the large surface area, and the in situ growth method, which provides a well-defined catalyst. These catalysts are potentially an attractive alternative to Pt in HERs, and therefore represent new technological opportunities for the development of renewable and economic hydrogen production.