This study assessed the effect of co-substitution of strontium (Sr) and magnesium (Mg) ions into the hydroxyapatite (HA) coating which was deposited on Ti–6Al–4V dental alloys by an electrochemical deposition process. The deposited layers were examined using energy-dispersive X-ray spectroscopy, scanning electron microscopy, Fourier transform infrared spectroscopy, atomic force microscopy and X-ray diffraction. The corrosion behavior of Ti–6Al–4V alloys in an artificial saliva environment was studied through potentiodynamic polarization technique and electrochemical impedance spectroscopy. The results indicated that the substituted Sr and Mg ions in HA improved the HA coating, where the protection efficiency percentage (PE%) for Ti–6Al–4V alloys coated with Sr/Mg-HA was higher than for those coated with HA only. Maximum PE% was 74.19% for Ti–6Al–4V alloys coated with Sr/Mg-HA. Coating of the dental Ti–6Al–4V alloys with co-substituted bioactive Sr and Mg ions in HA improved the corrosion resistance properties of the alloys in the saliva environment.