Chronic postsurgical pain (CPSP) and its emotional comorbidities poses health burden to patients who have received the surgical treatment. However, its underlying mechanism remains unclear. Emerging studies indicate that magnesium deficiency is associated with neurological diseases, and magnesium supplement confers protection under these disease conditions. In this study, we examined the role and mechanism of magnesium deficiency in the pathology of surgery-induced allodynia and negative emotion using a rat model of skin/muscle incision and retraction (SMIR) and investigated the therapeutic effects of magnesium supplementation by oral magnesium-L- Threonate (L-TAMS) in SMIR-injured rats. In the SMIR model, rats developed mechanical allodynia and anxiodepressive-like behaviors. Further, SMIR caused microglia and astrocyte activation and enhanced expression of pro-inflammatory cytokine (TNF-α, IL-1β and IL-6) in the anterior cingulate cortex (ACC). Importantly, magnesium ion (Mg) levels decreased in the serum and cerebrospinal fluid (CSF) of SMIR-injured rats, which exhibited high correlation with pain and emotion behavioral phenotypes in these rats. Repeated oral administration of L-TAMS increased serum and CSF levels of Mg in SMIR-injured rats. Notably, L-TAMS administration reversed SMIR-induced mechanical allodynia and anxiodepressive-like behaviors but did not affect pain and emotional behaviors in sham rats. Moreover, L-TAMS administration suppressed SMIR-caused glial activation and proinflammatory cytokine expression in the ACC but had no such effect in sham rats. Together, our study demonstrates the contributing role of magnesium deficiency in the pathology of surgery-induced chronic pain and negative emotion. Moreover, we suggest that L-TAMS might be a novel approach to treat CPSP and its emotional comorbidities.