Phosphorus-doped CoTe2/C nanoparticles create new Co-P active sites to promote the hydrogen evolution reaction.