Federer came through a tight clash to win 6-6 (7-5) 4-6 7-5 in two hours and 16 minutes.
He will now face Roberto Bautista Agut in today’s quarter-final and remains on course for a 10th Halle Open title.
And the 37-year-old says he was relieved to get through having lost the second set to set up a nail-biting decider.
“I always knew it was going to be tight because he has got a great first serve,” Federer said.
“He’s got all the chances to hit great forehands.
“He remains dangerous throughout, and I knew obviously once I gave away that lead things will get very, very tight and they did.
“It was a great match, great atmosphere. I really enjoyed it.”
The Swiss star says it was the perfect preparation for his last eight clash and is ready to for a different kind of test against Agut today.
“Roberto wins his points differently than Jo does,” he said.
“Jo does it with the serve and forehand and the power and the variety and his explosiveness.
“Whereas Roberto does it through just doing the same thing in repetition, and he’s also got a great forehand like Jo has.
“In some ways they are similar there but of course the serve is very different and he sets up the plays and the points different.
“From my side, I might have more play from the baseline, but then again we might be in more rallies on my serve, too. I’m looking forward to it.
“I have a good head-to-head against him and I’ve beaten him at Wimbledon once on the grass before.
“I hope that’s going to give me some confidence.”