Magnesium and its alloys are candidate materials for biodegradable implants; however, excessively rapid corrosion behavior restricts their practical uses in biological systems. For such applications, surface modification is essential, and the use of anticorrosion coatings is considered as a promising avenue. In this study, we coated Mg with hydroxyapatite (HA) in an aqueous solution containing calcium and phosphate sources to improve its in vitro and in vivo biocorrosion resistance, biocompatibility and bone response. A layer of needle-shaped HA crystals was created uniformly on the Mg substrate even when the Mg sample had a complex shape of a screw. In addition, a dense HA-stratum between this layer and the Mg substrate was formed. This HA-coating layer remarkably reduced the corrosion rate of the Mg tested in a simulated body fluid. Moreover, the biological response, including cell attachment, proliferation and differentiation, of the HA-coated samples was enhanced considerably compared to samples without a coating layer. The preliminary in vivo experiments also showed that the biocorrosion of the Mg implant was significantly retarded by HA coating, which resulted in good mechanical stability. In addition, in the case of the HA-coated implants, biodegradation was mitigated, particularly over the first 6 weeks of implantation. This considerably promoted bone growth at the interface between the implant and bone. These results confirmed that HA-coated Mg is a promising material for biomedical implant applications.