Periprosthetic infection remains a challenging clinical complication. We investigated the antibacterial properties of pure (99.9%) magnesium (Mg) in vitro and in an in vivo rat model of implant-related infection. Mg was highly effective against methicillin-resistant Staphylococcus aureus-induced osteomyelitis and improved new peri-implant bone formation. Bacterial icaA and agr RNAIII transcription levels were also assessed to characterize the mechanism underlying the antibacterial properties of the Mg implant.