The four-time champion in Melbourne booked a semi-final clash with Andy Murray after securing a hard-fought 7-6 (7-4) 4-6 7-6 (7-4) 3-6 6-3 win over the seventh-seeded Frenchman.
Federer was well below his best over the first four sets before moving up a gear in the decider, but he says there was no margin for error in his victory.
"It was tough the whole match. Any set could have gone either way," the 17-time Grand Slam champion said.
"It was tough because you never know what Jo-Wilfried is going to come up with. I feel a bit lucky to come through."
Murray has a 10-9 head-to-head edge over Federer but will need to beat the Swiss great in a Grand Slam for the first time if he is to progress to final.
"I've got to recover a little but I'm going to be fine - I'm young, I recover quick," Federer added of Friday's match.
"I'm looking forward to the match. It's going to be tough. He had a great year last year, winning his first Grand Slam and Olympic gold. He is a great guy and a great player."