Serbia’s Djokovic has won 24 Grand Slam titles – a men’s record – and claimed a long-awaited Olympic gold earlier this year.
The 37-year-old will face American world number seven Taylor Fritz in Saturday’s semi-final as he bids for a landmark 100th title.
Fritz, 26, comfortably beat Belgium’s David Goffin 6-3 6-4 on Friday to book his place in the last four. It extended a run that has seen Fritz progress past the third round for the first time in Shanghai.
Djokovic, who will now compete in a 78th Masters 1,000 semi-final, said he was motivated by matches against the upcoming generation.
“It keeps me going, and pushes me to really dig deep, and to show to the world that I’ve still got it in my legs, that I can still go the distance with the young guys,” he said.
“I’m super glad that I managed to win this very challenging match.”
Mensik, 19, held his nerve in the opening set against Djokovic.
Yet Djokovic, a record four-time winner of the tournament, was able to regroup after a scrappy performance in the tie-break and breezed through the second set, before putting the match to bed after two hours and 21 minutes.
Although US Open runner-up Fritz might provide a tough test for Djokovic, the decorated veteran holds a 9-0 career record from their past meetings.