Djokovic dropped the third and fourth sets, and appeared to be on route for a shocking defeat.
But he somehow managed to continue, and was perhaps aided by a break in play after 11.30pm local time.
Due to lockdown restrictions, fans had to leave the arena in order to be home by midnight, and both players were taken off.
That gave the Serbian star a brief break, during which he was able to rest and recover.
After returning to the court, he seemed a different animal and blitzed his way through the fifth set.