The use of intraoperative sub-anesthetic esketamine for postoperative analgesia is controversial. In this study, the impact of sub-anesthetic esketamine on postoperative opioid self-administration was determined. Patients who underwent spinal surgery with patient-controlled analgesia (PCA) from January 2019 to December 2021 were respectively screened for analysis. Postoperative PCA was compared between patients who received a sub-anesthetic esketamine dose and patients who were not treated with esketamine (non-esketamine group) with or without propensity score matching. Negative binomial regression analysis was used to identify factors associated with postoperative PCA. Patients who received intraoperative sub-anesthetic esketamine self-administered less PCA (P = 0.001). Azasetron, esketamine, and dexamethasone lowered the self-administration of PCA (IRR with 95% confidential interval, 0.789 [0.624, 0.993]; 0.581 [0.458, 0.741]; and 0.777 [0.627, 0.959], respectively). Fixation surgery and drinking were risk factors for postoperative PCA (1.737 [1.373, 2.188] and 1.332 [1.032, 1.737] for fixation surgery and drinking, respectively). An intraoperative sub-anesthetic dose of esketamine decreases postoperative opioid self-administration. Azasetron and dexamethasone also decrease postoperative opioid consumption. The study is registered at www.chictr.org.cn (ChiCTR2300068733).