The top seed, who has yet to drop a set in the tournament, beat Mayer 6-3 6-4 with his ninth Wimbledon title firmly in his sights.
Mayer was a 6-7 (6-8) 6-4 6-3 victor over sixth seed Lucas Pouille, while wildcard Andrey Rublev beat Mikhail Youzhny in an all-Russian second round match and will now face another compatriot in the form of Khachanov.
The All England Lawn Tennis Club (AELTC) use a unique seeding system that takes into account a player's Emirates ATP Ranking points as of 26 June in addition to 100% of the points earned for all grass-court tournaments in the previous 12 months.
As for the defending champion, Mayer has not had the best of seasons so far.
Trump lashes out at 'bad,' 'conflicted' Russia investigators
The tweet marked the first public, official confirmation that the president is under investigation for firing Comey in May. On Thursday, it was reported that President Trump himself was under investigation for possible obstruction of justice .
The world number nine was plagued by a wrist injury for much of the clay-court campaign and, although he reached the quarter-finals at the French Open, he has not won a title this year.
Mayer gave up a 5-3 lead in the opening set and went on to lose it in the tie breaker but he fought back hard in the next two sets to claim the win.
"I think the second part of the season will be really crucial for Andy, and Novak [Djokovic] as well".
The Swiss star will now face Russian 21-year-old Karen Khachanov for a place in the final with either Richard Gasquet or Alexander Zverev. "He plays a bit different on the serve and the forehand, which is different to the regular forehand technique we see". It's a match I will most likely have to focus on my own game, make sure I serve well because he can go through spells where he can serve big and well. "I'm glad I could win in two sets and have the feeling I played well".