The construction of highly efficient and self-supported electrocatalysts with abundant active sites for pH-universal hydrogen evolution reaction (HER) and alkaline water splitting is significantly challenging. Herein, Co and MoC nanoparticles embedded in nitrogen-doped carbon nanofibers (Co-MoC/NCNFs) which display a bamboo-like morphology are prepared by electrospinning followed by the carbonization method. The electrospun MoC possesses an ultrasmall size (≈5 nm) which can provide more active sites during electrocatalysis, while the introduction of Co greatly optimizes the electronic structure of MoC. Both endow the Co-MoC/NCNFs with superior HER performances over a wide pH range, with low overpotentials of 86, 116, and 145 mV to achieve a current density of 10 mA cm