Aim: Thyroidectomy is frequently associated with substantial postoperative pain. Esketamine, an N-methyl-D-aspartate receptor antagonist, has been demonstrated to be effective in multiple analgesia. We hypothesized that intraoperative administration of esketamine may reduce perioperative opioid consumption and postoperative pain in patients undergoing thyroidectomy. Methods: Sixty patients undergoing thyroidectomy were randomly assigned to two groups. Patients in the saline group received a pre-incisional intravenous bolus of 0.9% NaCl followed by an intraoperative infusion of 0.9% NaCl; patients in the esketamine group received a pre-incisional intravenous bolus of esketamine (0.5 mg kg-1) followed by an intraoperative infusion of esketamine (0.24 mg kg-1 h-1). The primary outcome was perioperative sufentanil consumption. The postoperative pain, sleep quality, and adverse events during the first postoperative 24 h were also evaluated. Results: Patients in the esketamine group consumed significantly less sufentanil than those in the saline group (24.6 ± 3.1 μg vs. 33.7 ± 5.1 μg, mean difference, 9.1; 95% confidence interval, 6.9–11.3, P <0.001). Postoperative pain scores were significantly lower in the esketamine group than those in the saline group during the first 24 h postoperatively (P <0.05). Patients receiving esketamine experienced higher sleep quality than those in the saline group during surgical night (P = 0.043). There were no significant differences in adverse events between the two groups. Conclusion: Intraoperative administration of esketamine reduces perioperative sufentanil consumption and postoperative pain without increasing adverse events in patients undergoing thyroidectomy. The development of combined anesthesia regimens, including esketamine, may foster strategies for pain management during thyroidectomy.