PurposeThe current study was designed to investigate the analgesic effect of esketamine on patients underwent thoracoscopic surgery and the underlying mechanism.MethodsIn this randomized, double blind, placebo-controlled study, 60 patients scheduled to undergo thoracoscopic lobectomy or segmentectomy were randomized to two groups to receive esketamine (group ESK) or saline (group SAL), respectively. 0.25 mg·kg−1 esketamine was given in group ESK for induction of anesthesia, and 0.12 mg·kg−1·h−1 esketamine for intraoperative maintenance. Group SAL received an equal volume of saline. The primary outcomes were the visual analogue scale (VAS) pain scores at rest and deep cough state which evaluated at departure from post-anesthesia care unit (PACU) (T1), 6 h, 24 h and 48 h after surgery (T2–T4). The secondary outcomes included the levels of white blood cell (WBC) count, absolute neutrophil count (ANC), interleukin-6 (IL-6), procalcitonin (PCT), anxiety/depression scores at T3, oxygen saturation (SpO2), and adverse reactions.ResultsEsketamine significantly decreased both rest and cough VAS pain scores at T1, and rest pain scores at T1, T2 and T4. Patients in ESK group had significantly lower WBC and ANC levels than SAL group, while the alteration of IL-6 and PCT levels between groups showed no significance. The anxiety scores of patients in both groups were significantly decreased after surgery. However, the depression scores of patients in ESK group did not decrease after surgery when compared with the preoperation. The postoperative SpO2 and the incidence of adverse reaction including postoperative nausea, vomiting, dizziness and dissociative symptom showed no significant difference between two groups (p > 0.05).ConclusionEsketamine can alleviate the acute postoperative pain of patients undergoing thoracoscopic surgery without increasing adverse reactions, and the underlying mechanism may be associated with the reduction of postoperative inflammation.Trial registrationRegistered at Chinese Clinical Trial Registry on February 7, 2022 (ChiCTR 2200056524).Graphical