Chronic postsurgical pain (CPSP) is a serious issue for many postoperative patients. Though there are numerous treatment options for the prevention of CPSP, none of them is optimal as the mechanisms of the transition from acute to chronic postoperative pain have not been elucidated. Ketamine and opioids have been administered for chronic postoperative pain treatment but induce severe adverse reactions and/or physical dependency. Here, we examined whether pre-administration of the nonselective N-methyl-d-aspartate (NMDA) receptor antagonist magnesium sulfate attenuates CPSP behavior and alters the expression of glutamate ionotropic receptor NMDA type subunit 1a (Grin1 mRNA) in a rat skin/muscle incision and retraction (SMIR) model. We assessed the effects of a single subcutaneous magnesium sulfate injection on nociceptive behaviors including guarding pain, mechanical hyperalgesia, and heat hypersensitivity in rats after SMIR surgery. We used reverse transcription-quantitative PCR (RT-qPCR) to evaluate Grin1 mRNA expression in the dorsal horn of the spinal cord on postoperative day 14. Compared with the vehicle, magnesium sulfate administration before SMIR surgery reduced mechanical hyperalgesia for 17 d Grin1 gene expression was significantly higher on the ipsilateral side than the contralateral side (P = 0.001) on postoperative day 14. The magnesium sulfate injection prevented Grin1 mRNA upregulation in the spinal cord dorsal horn. A single magnesium sulfate injection mitigated SMIR-induced mechanical hyperalgesia possibly by modulating Grin1 expression. Preoperative magnesium sulfate administration could prove to be a simple and safe CPSP treatment.