In this randomized controlled trial, 74 patients scheduled for gynecological laparoscopic surgery (American Society of Anesthesiologists grade I/II) were enrolled and randomly divided into two study groups: (i) Group C (control), received sufentanil (0.3 μg/kg) and saline, followed by sufentanil (0.1 μg/kg∙h) and saline; and (ii) Group F (OFA), received esketamine (0.15 mg/kg) and lidocaine (2 mg/kg), followed by esketamine (0.1 mg/kg∙h) and lidocaine (1.5 mg/kg∙h). The primary outcome was the 48-h time-weighted average (TWA) of postoperative pain scores. Secondary outcomes included time to extubation, adverse effects, and postoperative sedation score, pain scores at different time points, analgesic consumption at 48 h, and gastrointestinal functional recovery. The 48-h TWAs of pain scores were 1.32 (0.78) (95% CI 1.06–1.58) and 1.09 (0.70) (95% CI 0.87–1.33) for Groups F and C, respectively. The estimated difference between Groups F and C was − 0.23 (95% CI − 0.58 − 0.12; P = 0.195). No differences were found in any of the secondary outcomes and no severe adverse effects were observed in either group. Balanced OFA with lidocaine and esketamine achieved similar effects to balanced anesthesia with sufentanil in patients undergoing elective gynecological laparoscopic surgery, without severe adverse effects.Clinical Trial Registration: ChiCTR2300067951, www.chictr.org.cn 01 February, 2023.