Hypoxaemia and hyperoxaemia may occur after surgery, with related complications. This multicentre and randomised trial evaluated the impact of automated closed-loop oxygen administration after high-risk abdominal or thoracic surgeries in terms of optimising the SpO2 time within target range.After extubation, patients with an intermediate to high risk for postoperative pulmonary complications were randomised to Standard or Automated closed-loop oxygen administration. The primary outcome was the percentage of time within the oxygenation range, during a 3-day frame. The secondary outcomes were the time with hypoxaemia and hyperoxaemia under oxygen.Among the 200 patients, time within range was higher in the Automated group, both initially (≤3-h; 91.4±13.7 versus 40.2±35.1% of time; difference +51.0% [CI95% -42.8;59.2]; p<0.0001) and during the 3-day period (94.0±11.3 versus 62.1±23.3% of time; difference +31.9% [CI95% 26.3;37.4]; p<0.0001). Periods of hypoxaemia were reduced in the Automated group (≤3 days; 32.6±57.8 [1.2±1.9%] versus 370.5±594.3 min [5.0±11.2%]; difference -10.2% [CI95% -13.9;-6.6]; p<0.0001), as well as hyperoxaemia under oxygen (≤3 days; 5.1±10.9 [4.8±11.2%] versus 177.9±277.2 min [27.0±23.8%]; difference -22.0% [CI95% -27.6;-16.4]; p<0.0001). Kaplan-Meier analysis depicted a significant difference in terms of hypoxaemia (p=0.01) and severe hypoxaemia (p=0.0003) occurrence between groups in favour of the Automated group. Twenty-five patients experienced hypoxaemia for more than 10% of the entire monitoring time during the 3 days within the Standard group, as compared to the Automated group (p<0.0001).Automated closed-loop oxygen administration promotes greater time within the oxygenation target, as compared to Standard manual administration, thus reducing the occurrence of hypoxaemia and hyperoxaemia.