In this study, Ni-P/Ni(OH)2-ceramic nanoparticle composite coatings were directly deposited onto commercially pure magnesium in order to improve its resistance to erosion-corrosion damage. The effect of three incorporated ceramic nanoparticles (TiO2, SiC and diamond) on the erosion-corrosion resistance of the composite coatings was also investigated. The composite coatings were obtained by an electroless process and were characterized using scanning electron microscopy, Raman spectroscopy and X-ray diffraction. The erosion-corrosion behavior of fabricated composite coatings was elucidated using in situ techniques of potentiodynamic polarization and electrochemical impedance spectroscopy (EIS). It was found that the simultaneous formation of Ni-P and β-Ni(OH)2 phases in the coating and the improvement in the micro hardness of the coating were due to the incorporation of nanoparticles. According to the polarization curves and EIS spectra, the β-Ni(OH)2 compound behaves like a pre-passive film which is responsible for substantial improvement in the anticorrosion properties of the coating. Better erosion-corrosion resistance was obtained for the composite coatings than the neat Ni-P coating. This was a consequence of the β-Ni(OH)2 co-deposition. The formation of the β-Ni(OH)2 compound in the coating does not depend on the nature and concentration of the nanoparticles.