The world number one showed his trademark mental strength to face down his inspired opponent, prevailing 6-3, 4-6, 7-6 (7/4), 6-3 in more than three hours.
It followed a gruelling first-round match on Sunday, when he was kept on court for more than four hours by teenager Dino Prizmic, admitting afterwards he was "a bit under the weather”.
The Serbian, who let out a huge roar after sealing victory over Popyrin, said the Australian was the better player for a set and a half but that momentum shifted in the third-set tie-break.
Djokovic still searching for form
"I haven't been playing my best," he added. "I'm still trying to find form. But, particularly in the early rounds, you face players who have nothing to lose really.
"They come out on centre court trying to play their best match.
"Both my first and second-round opponents were really quality tennis players. I managed to find a way to win in four, that's what counts in the end. Hopefully I can find a way to build on this as the tournament progresses.”
The 10-time champion cruised through the first set on Rod Laver Arena.
But his unforced error count ticked up in the second set and he was broken for the first time in the fourth game.
Popyrin appeared to have blown his chance to level when he produced a sloppy service game when serving for the set.
However, Djokovic, again looking out of sorts and blowing his nose during changeovers, failed to build on his break and the Australian produced an impressive backhand lob to level the match, urging the crowd to up the volume.
Popyrin asked for a medical timeout when leading 3-2 in the third set and received treatment on his left calf, accompanied by a Mexican wave among the fans.
The pivotal point in the match came in the 10th game.
Three uncharacteristic unforced errors from Djokovic's racquet gave Popyrin three set points but he was unable to capitalise, also missing out on a fourth opportunity as the top seed levelled in a game lasting nearly 10 minutes.
Djokovic, 36, won the tie-break to take a firm grip on the match as Popyrin received more treatment on his leg.
The Serbian got into an altercation with some fans early in the fourth set but re-focused, breaking to love in the sixth game, which proved decisive.
He is gunning for an 11th Australian Open title to pull clear of Margaret Court on the all-time list of majors and will next meet Argentine Tomas Martin Etcheverry.