Djokovic said he showed “a lot of guts” to come back from a set down in humid conditions to beat inspired qualifier Yannik Hanfmann and reach the fourth round.
The 38-year-old Serb looked sluggish in the first set but recovered to win 4-6 7-5 6-3 in two hours and 42 minutes.
Djokovic will face unseeded Spaniard Jaume Munar in the last 16.
“The crowd got me up, and towards the end of the second set I started to get into it more,” said the world number five, who leaned on the vociferous local support throughout the match,
“I have often had to fight in matches that maybe I wasn’t the better player – battling through is something I am quite familiar with throughout my career, but I hung in there and showed a lot of guts.”
Hanfmann is ranked 150th in the world and made it through qualifying to set up what would have been only the second victory of his career against a player in the world’s top five.
The 33-year-old took the first set with an ace after claiming 17 winners to Djokovic’s 10, with the 24-time Grand Slam winner failing to force a single break point.
Djokovic looked to be struggling with the heat and humidity, throwing water over his head after holding for 3-2 in the second set.
“It’s brutal when you have over 80% of humidity day after day – particularly for the guys when they’re playing during the day with heat, with sun, it’s even more brutal,” added Djokovic, whose matched finished after 9pm, local time.
“For me, biologically, it’s a bit more challenging to deal with it, but I had to really weather the storm today. Yannick played an incredible match from the beginning.”
Djokovic slowly upped his levels and finally forced his first break points of the match with Hanfmann serving to stay in the second set at 6-5.
The spectators cranked up the decibel levels as Djokovic smashed a winner to take the set and level the match, then pointed to his ear in celebration to acknowledge the support.
Hanfmann’s accuracy waned in the deciding set and after firing a forehand long to hand Djokovic a break at 3-1, the Serb served out the set to make it through.