Absent from the prestigious tournament since 2016 due to injuries and a desire to maintain his ageing limbs, he was scheduled to appear in the last 32 at the event on Wednesday night.
But his opponent Milos Raonic pulled out with an elbow injury.
The extra rest appeared to have reinvigorated the 37-year-old who raced into a double break lead of 4-1 against the 13th seed Fabio Fognini.
However the Italian did not buckle and edged his way back to 4-3. Federer stopped the rot and eventually served for the set at 5-4.
But two double faults and a wayward ground stroke left him facing two break points at 15-40.
But he dipped into his well of tricks and claimed the next four points to wrap up the opener.
In the second set, with Fognini serving to stay in the match at 3-5, a Federer backhand service return to bring up match point left the fans gasping in astonishment.
Fognini too seem befuddled and double faulted to offer up the match. It was his fourth consecutive loss to the Swiss.
With his quarter-final berth secured, Federer basted the fans. “I’m so happy to be back here in Paris,” he said. One the cheers died down, he added: “I am sorry I haven’t come until now but I’m 37, I’ve got four kids. It’s difficult for me but it’s a pleasure to be here.”
Federer’s presence this year at the tournament had been in doubt until Tuesday. He left the organisers waiting because he wanted to assess his fitness after his run to the Swiss Indoors title in his home town of Basel.
He told the packed centre court: “People ask me: ‘How do you do it?’ And I tell them: Bercy on evenings like tonight, you’ll understand why and how.”
Federer will play on Friday against either the 10th seed Kei Nishikori or the seventh seed Kevin Anderson, the man who ended his dream in the quarter-final at Wimbledon in July.
The other quarter finals pit the second seed Novak Djokovic against the fifth seed Marin Cilic while the defending champion, Jack Sock, will take on the sixth seed Dominic Thiem.
A taste of the future will also be on show. Alex Zverev, the German 21-year-old, will battle with Karen Kachenov. The 22-year-old Russian saved two match points during his three set last 16 slugfest against the eighth seed John Isner.