Background: Postoperative pain in ambulatory surgery is a multifactorial issue affecting patient satisfaction, time of discharge, and rehospitalization. This study evaluated the efficacy and safety of nalbuphine for the treatment of postoperative pain after ambulatory surgery, relative to tramadol. Methods: This multi-center, randomized, double blind, and controlled study was conducted at 10 centers. In accordance with the inclusion criteria, 492 ambulatory surgery patients were recruited. These patients had moderate to severe pain after ambulatory surgery, with a visual analogue scale (VAS) score > 3 cm. They were randomly divided into an experimental (n = 248) or control (n = 244) group and treated for analgesia with 0.2 mg/ kg of nalbuphine or 2 mg/kg of tramadol, respectively. VAS scores, adverse events, and vital signs of the patients were recorded before administration (baseline; T 1); and 30 min (T 2), 2 h (T 3), 4 h (T 4), and 6 h (T 5) after administration of analgesia. A decrease in pain intensity of more than 25% compared with the baseline was used as an indicator of analgesic efficacy. The experimental and control groups were compared with regard to this indicator of efficacy at each timepoint. Results: The VAS scores of the experimental and control groups were statistically comparable at timepoints T 1-T 4. At T 5 , the VAS scores of the experimental group were significantly lower than that of the control. The pain intensity was significantly higher in the experimental group compared with the control at T 2 and T 3. Adverse events and vital signs were similar for the two groups at each timepoint. Conclusions: Nalbuphine can provide effective and safe pain relief in patients after ambulatory surgery. Trial registration: The registration number is ChiCTR-IOR-16010032, the date of registration was 2016-11-28.