Remifentanil is commonly used clinically for perioperative pain relief, but it may induce postoperative hyperalgesia. Low doses of ketamine have remained a common choice in clinical practice, but the mechanisms of ketamine have not yet been fully elucidated. In this study, we examined the possible effects of ketamine on calcium/calmodulin-dependent protein kinase II α (CaMKIIα) and N-methyl-d-aspartate receptor (NMDAR) subunit NR2B in a mouse model of remifentanil-induced postoperative hyperalgesia (RIPH) in the primary somatosensory cerebral cortex (SI) region. The paw withdrawal mechanical threshold (PWMT) and paw withdrawal thermal latency (PWTL) were used to assess mechanical allodynia and thermal hyperalgesia, respectively, before and after intraoperative remifentanil administration. Before surgery, mice received intrathecal injections of the following drugs: ketamine, NMDA, BayK8644 (CaMKII activator), and KN93 (CaMKII inhibitor). Immunofluorescence was performed to determine the anatomical location and expression of activated CaMKIIα, phosphorylated CaMKIIα (p-CaMKIIα). Additionally, western blotting was performed to assess p-CaMKIIα and NMDAR expression levels in the SI region. Remifentanil decreased the PWMT and PWTL at 0.5 h, 2 h, and 5 h and increased p-CaMKIIα expression in the SI region. Ketamine increased the PWMT and PWTL and reversed the p-CaMKIIα upregulation. Both BayK8644 and NMDA reversed the effect of ketamine, decreased the PWMT and PWTL, and upregulated p-CaMKIIα expression. In contrast, KN93 enhanced the effect of ketamine by reducing hyperalgesia and downregulating p-CaMKIIα expression. These results suggested that ketamine reversed RIPH by inhibiting the phosphorylation of CaMKIIα and the NMDA receptor in the SI region in mice.