The development of noble-metal-free electrocatalysts with high electrocatalytic performance and stability by adopting a scalable route is key to solving the energy crisis. We report a PNi co-doped Mo2C-based electrocatalyst with high hydrogen evolution reaction (HER) catalytic activity prepared by a molten-salt method. Using phosphating times of 2 h and 4 h yielded P-Ni-Mo2C-2h and P-Ni-Mo2C-4h, respectively, both of which exhibited nanoflower-like structures that provided abundant active sites for the reaction. P-Ni-Mo2C-2h possessed good electrocatalytic properties with a low overpotential of only 140.5 mV at j = 10 mA cm−2 and a small Tafel slope of 50.7 mV dec−1 in an alkaline environment. P-Ni-Mo2C-2h exhibited excellent stability after 20 h of continuous hydrogen production. The use of an excessively long phosphating time caused a narrow down of spaces formed by nanoflakes, thereby reducing the HER performance of the electrocatalyst. The results of this study provide guidelines for the preparation of high-efficiency PNi co-doped electrocatalysts.