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 semi-finals.
The 134th-ranked German made the quarter-finals by seeing off French sixth seed Lucas Pouille 6-7 (6/8), 6-4, 6-3.