The 38-year-old went a set down against the big-serving German but came from behind to clinch a 4-6 7-5 6-3 victory and progress to the last 16.
Djokovic was broken in the third game of the match, and Hanfmann held his serve for the remainder of the opening set to take a 1-0 lead, but from there the Serb held firm to claim the win.
Reflecting on the conditions, Djokovic said: “I’ve been saying it before, it’s the same for every player that steps out on the court.
“It’s brutal, it’s brutal when you have over 80% humidity day after day. For the guys, particularly playing in the day with heat and sun, it’s even more brutal. It is what it is; you just have to deal with it.
“For me, biologically a bit more challenging to deal with it.”
The Serbian, who lost last year’s final against then world No. 1 Jannik Sinner, will face unseeded Spaniard Jaume Munar in the last 16.
Hanfmann, ranked 150th in the world, claimed 17 winners to Djokovic’s 10 in the first set – but the 24-time Grand Slam winner overcame his failure to force a single break point in the opener to see off his opponent.
It was not before he was pictured throwing water over his head after holding for 3-2 in the second set, rallying to break Hanfmann and force the decider – before cupping his ear in celebration to the spectators.
/origin-imgresizer.tntsports.io/2025/10/06/image-d6821423-fd5a-42a5-8f9d-85f914687357-85-2560-1440.jpeg)
‘I had to really weather the storm’ – Djokovic on ‘brutal’ conditions in Shanghai
Video credit: SNTV
Djokovic – bidding for a record-extending fifth title in Shanghai – added: “I had to really weather the storm today. Yannick played an incredible match from the beginning, one mediocre game from my side in the first set at 1-1 was enough for him to break the serve and win the set.
“It was so hard to read his serve, he was serving so accurately with a high percentage and smacking every ball he had on his racket, so tough to play someone like that.
“The crowd really got me up towards the end of the second set. I started to feel I could stay in the rally, read his serve, he was starting to make some errors, I was starting to swing more freely through the ball.
“All in all, a great fight, a battle., something that I’m quite familiar with throughout my career. I’ve won plenty of matches where I maybe haven’t been the better player for most of the match, but hung in there with a lot of guts.
“Grinding almost three hours, third round at the masters, 38 with a full stadium cheering my name, it’s a dream come true for me. I’m very grateful.”
 
			 
			 
			