Federer, the 18-time Grand Slam title winner who is building up for an assault on an eighth Wimbledon title next month, next faces 2016 Halle champion Florian Mayer for a place in the semifinals.
The 134th-ranked German made the quarterfinals by seeing off French sixth seed Lucas Pouille 6-7 (6/8), 6-4, 6-3.