As potential degradable biomaterials, magnesium (Mg) alloys have development prospects in the field of orthopedic load-bearing, whereas the clinical application has encountered a bottleneck due to a series of problems caused by its rapid corrosion. In this study, strontium-substituted calcium phosphate (CaP) coatings with different structures were prepared on the surface of the Mg matrix by a simple one-step electrodeposition method at different temperatures, which enhanced the poor corrosion resistance of the Mg matrix. The coated sample prepared at 65 °C reduced the corrosion current density by 3 orders of magnitude and increased the impedance by nearly 2 orders of magnitude compared with bare Mg alloy, thanks to its dense fibrous structure similar to that of natural bones. Although the coating composition varies with different preparation temperatures, CaP, as an inorganic component similar to natural bone, has good cytocompatibility. Doping the right amount of strontium, which is a trace element in human bones, is beneficial to stimulate osteoblast differentiation, inhibit the activity of osteoclasts, and induce the formation of bone tissues. This provides a new option for modifying the Mg alloy with CaP coatings as a base.