The world number one, who became the youngest man to complete the career Grand Slam at the Australian Open earlier this month, notched his ninth straight win of 2025 with a 6-2, 7-5 success despite trailing 5-2 in the second set.
"There were some moments when I thought about a third set, I'm not going to lie, but obviously it was just a small place in my mind that was thinking that," Alcaraz said.
"The rest was working to find solutions, to find the right way again."
The 22-year-old will play Russian seventh seed Karen Khachanov for a semi-final berth on Thursday. Alcaraz has won all five of his previous meetings with Khachanov, losing only one set in the process.
Alcaraz raced through the opening set against Royer, breaking twice without facing a break point.
But the 60th-ranked Royer raised his level in the second, missing a break point in the second game but making no mistake shortly afterwards to stretch 3-1 in front.
Alcaraz immediately carved out an opportunity to hit straight back in the next game, but Royer managed to consolidate his break.
The underdog could not close out the set when he served for it, though, as Alcaraz broke back in game nine.
The Spaniard made Royer pay, eventually reeling off five consecutive games to wrap up victory.
He did so after rival Jannik Sinner, playing his first tournament since losing to Novak Djokovic in the Australian Open semi-finals last month, eased to a 6-3, 7-5 win over Australian Alexei Popyrin.
Stefanos Tsitsipas reached his first quarter-final since the Barcelona Open last April, beating former world number one Daniil Medvedev 6-3, 6-4.
France's Arthur Fils, playing only his fourth tournament since withdrawing from last year's French Open injured, saw off compatriot Quentin Halys 6-1, 7-6 (9/7).
