The 35-year-old Swiss, who is aiming for a record eighth Wimbledon crown and 19th Grand Slam title, beat Alexander Zverev 6-1 6-3 in 53 minutes.
German Zverev, 20, beat Federer in last year’s semi-final.
“It was by far my best match of the week. I’m feeling excellent and it’s a pleasure to be back,” said Federer, who skipped the clay-court season to rest.
Wimbledon starts on Monday, 3 July.