It took Djokovic 302 minutes to beat the 15th seed 1-6 7-5 6-4 6-7 12-10 and set up a last-eight meeting with Tomas Berdych.
© PA Photos
The world number one was broken three times during the opening set, which went the way of his Swiss opponent after 25 minutes on Rod Laver Arena.
Djokovic broke Wawrinka's serve in the opening game of the second set, but the Swiss then capitalised on some uncharacteristic errors from the Djokovic backhand to win the next two games.
The slipping Serb had fallen over five times before he finally decided to change his footwear between games three and four of set two.
While new trainers helped Djokovic stay on his feet for the remainder of the match, he continued to produce errors and was immediately broken to 30, handing Wawrinka a 3-1 lead in the second.
Wawrinka was just two points away from sealing a two-set lead when he went 5-3 and 30-0 ahead on his own serve.
However, Djokovic finally found his form and reeled off four straight points to claim the vital break back.
Wawrinka appeared to be rattled by his missed opportunities and Djokovic pounced on his opponent's insecurities to break again and level the match at one set all.
Some superb net play helped Djokovic win the third set and take the lead for the first time in the match.
All 12 games then went with serve in the fourth, leading to a tie-break, which Wawrinka won 7-5.
The Swiss made the perfect start in the deciding set, as he broke to 30 in the opening game.
However, the top seed broke back straight away before the next 19 games went with serve.
Wawrinka had failed to convert four breaks points at 4-4 and Djokovic punished him in game 22 when he converted match point at the third attempt to break to 40 and end the match at 1.41am local time.
Djokovic, who is aiming to become the first ever man to win three consecutive singles titles at Melbourne Park, hit 51 winners and produced 66 unforced errors.