Mayer made four unforced errors when serving for the second set at 5-4 which opened the door for Djokovic to take a straight-set victory.
He will play Tomas Berdych in the semifinals against whom he has a 21-2 winning record. Berdych, of the Czech Republic, beat Kyle Edmund of Britain 6-3, 6-2.
“I think I’ve played better first and second sets, but credit to him for being solid and going for his shots,” Djokovic said. “The second set was very close, and it could’ve gone his way. It was a good test to see where I am.”
Despite being broken four times, second-seeded Rafael Nadal advanced to the semifinals with a 6-3, 5-7, 6-4 win against Andrey Kuznetsov of Russia.
“He played so crazy with amazing shots,” said Nadal. “It’s true that I missed the serve more times than what I wanted. I think I played a great third set, because if not, I will not be in that semifinal.”
Nadal will next play Illya Marchenko. The Ukrainian, who beat fourth-seeded David Ferrer in the first round, defeated seventh-seeded Jeremy Chardy of France 6-3, 7-6 (3).
“I saw him play during the whole week,” said Nadal. “He’s playing fantastic. The match against David was great, and today against Jeremy he played amazing, too. He’s playing with big confidence.”