Background The present study aimed to observe whether the ultrasound-guided continuous erector spinae plane block (ESPB) has an effect on opioid consumption and postoperative rehabilitation in patients who undergo video-assisted thoracic surgery (VATS).Methods In this prospective study, 120 patients aged 20–70 yrs, undergoing elective VATS, were randomly allocated to one of three groups: Group C (General anaesthesia with patient-controlled intravenous analgesia [PCIA]), Group T (General anaesthesia with patient-controlled epidural analgesia [PCEA]), or Group E (General anaesthesia with continuous ESPB and PCIA). The perioperative opioid consumption; VAS scores; preoperative and postoperative QoR-15 score; and postoperative opioid-related adverse events were all assessed.Results The intraoperative sufentanil consumption in group T and E was significantly lower than that in group C (both P < 0.001), and the postoperative sufentanil consumption in group E was also significantly lower than that of group C (P = 0.001). Compared with group C, the VAS scores at rest or during coughing immediately out of the post-anesthesia care unit (PACU), at postoperative 6h, 12h, and 24h, were significantly lower in group T (P < 0.05). However, the VAS scores in group E were lower than those of group C only at rest at postoperative 6h and 12h (P < 0.05), and were significantly higher than those of group T at all study times (P < 0.05).Conclusion Ultrasound-guided continuous ESPB could significantly reduce perioperative opioid consumption in VATS and improve postoperative rehabilitation. However, these effects were inferior to those provided by TEA.Trial registration The present study was prospectively registered at http://www.chictr.org/cn /(Registration number: ChiCTR1900023050); Registration date: May 8,2019