Roger Federer will face Florian Mayer in the quarter-finals of the German Tennis Championships after a 6-4 6-3 win over Jan Hajek.