<bold>Objective: </bold>To investigate the analgesic effect of esketamine combined with low-dose sufentanil in elderly patients after gastrointestinal surgery, and whether the anti-inflammatory effect of esketamine is involved in the mechanism of postoperative delirium. <bold>Method: </bold>We enrolled sixty elderly patients (age >= 65 years old, American Society of Anesthesiologists (ASA) grade I-III) who underwent gastrointestinal surgery. Patients were randomly assigned to Group C (control group) who received sufentanil 2 ug/kg, and Group E (experimental group) who received sufentanil 1.5 ug/kg + esketamine 1 mg/kg, with 30 patients in each group. All patients underwent total intravenous anesthesia during the surgery and were connected to a patient-controlled intravenous analgesia (PCIA) pump after surgery. The primary outcome was the evaluation of pain at 4, 24, 48 h after surgery which was evaluated by NRS scores. In secondary outcomes, inflammation was assessed by measuring IL-6 levels using ELISA. The postoperative delirium and the occurrence of adverse reactions were observed on the 1st and 3rd day after surgery. <bold>Results: </bold>The NRS scores at 4, 24, and 48 h after surgery in the experimental group [(4.53 +/- 1.22), (3.46 +/- 0.73), (1.37 +/- 0.99)] were lower than that in the control group [(5.23 +/- 1.16), (4.46 +/- 0.77), (2.13 +/- 0.78)] (P < 0.05). The concentration of serum IL-6 in the experimental group at 24 and 48 h after operation [(15.96 +/- 4.65), (11.8 +/- 3.24)] were lower than that in the control group [(23.07 +/- 4.86), (15.41 +/- 4.01)] (P < 0.05); the incidence of postoperative delirium in the experimental group was less than that in the control group (P < 0.05); there was no significant difference in the incidence of postoperative nausea and vomiting between the two groups (P > 0.05), and neither group had nightmares or delirium. <bold>Conclusion: </bold>Esketamine may enhance postoperative pain management compare with sufentanil, and esketamine has anti-inflammatory effects that reduce the incidence of postoperative delirium.