World number one Novak Djokovic kept his hopes of a third successive Australian Open title alive with an extraordinary defeat of Stanislas Wawrinka.

Djokovic came through 1-6 7-5 6-4 6-7 (5/7) 12-10 in five hours and two minutes of absorbing tennis against an opponent who was inspired.

Having withstood an early Wawrinka barrage it seemed the momentum had turned in the Serbian's favour when he claimed sets two and three.

But back came Wawrinka to win the fourth in an epic tie-break to take it to a decider which could have gone either way until Djokovic finally made the breakthrough with the match finishing at 1.43am local time.

"It's really hard to find the words to describe the feeling we had tonight, especially in the fifth set," said Djokovic.

"He equally deserved to be a winner of this match. I give him a lot of credit, he has my respect. He showed his quality and was the aggressive player on the court."

Djokovic came through some nervous moments, none more so than when he found himself a set and 5-3, 30-0 down with Wawrinka closing in on a commanding lead.

But the Swiss got edgy, coughing up three unforced errors which gave Djokovic a route out of trouble and he gleefully accepted.

The momentum was firmly with the Serbian and he broke again for 6-5 before levelling the match on his own serve.

"Even at a set and 5-3 down I believed I could come back," Djokovic said.

"I was just being outplayed by my opponent. In those circumstances when you are not playing the way you want to play, you just try to fight and hope for the best."

To that point it had been all Wawrinka, the 27-year-old blasting winner after winner from all parts of the court with his single-handed backhand particularly venomous.

Djokovic, who has now won 18 consecutive matches here, had no answer. He looked ill-at-ease, not helped by frequently slipping as he struggled with his footwear.

Once level, though, he was expected to go on and turn the screw.

The early signs in the third set backed up that theory as he broke immediately, only for Wawrinka to rip up the script and hit back.

It remained tight, the two trading lusty blows from the back of the court until the ninth game when Wawrinka again blinked, although credit to Djokovic for raising his level when it really mattered.

Wawrinka would still not go away and he had break-point chances in the second and fourth games of the fourth set with Djokovic clinging on grimly.

Cling on he did, though, to take it to a dramatic tie-break.

Wawrinka never trailed and had three set points at 6-3. Djokovic dragged back two of them but Wawrinka came up with some inspired tennis to take the third with a point again set up by a wonderful backhand down the line.

The decider started, as the second did, with two breaks before serve again took over.

By now Wawrinka was appearing to cramp, stretching his right quadriceps at every opportunity.

It was not affecting his performance though, and after saving a break point at 3-4 he created four opportunities of his own in the next game, piling the pressure on Djokovic.

The Serbian came through, though, saving the first with an audacious drop shot and the fourth when Wawrinka failed to challenge a call on the baseline when replays showed it was in.

Serve then dominated with few chances on either side of the net until 10-11, when Djokovic's returning game clicked.

Wawrinka saved the first two match points - the first with a big serve and the second with an incredibly gutsy backhand winner down the line - but on the third he had no answer, as Djokovic ripped a backhand past him at the net.

Djokovic will take on fifth seed Tomas Berdych next, the Czech coming through in straight sets against South African Kevin Anderson.

Elsewhere, ourth seed David Ferrer cruised past Kei Nishikori with what he described as "one of the best matches of my career at the Australian Open".

Nishikori, the 16th seed, offered little threat to the Spaniard who won 6-2 6-1 6-4 in two hours and 10 minutes to advance to his third successive quarter-final in Melbourne.

Ferrer broke twice in each of the first two sets to set up a comfortable win. The third was wild as Nishikori started to go for broke but, hampered by a knee injury, he failed to seriously threaten Ferrer's chances of victory.

The fourth seed said: "It was a tough match but in the first two sets I didn't make any mistakes.

"Today I played very well, it was one of the best matches of my career at the Australian Open.

"I'm happy with my game."

Ferrer will take on another Spaniard, Nicolas Almagro, in the last eight after he advanced when Janko Tipsarevic had to withdraw through injury.

Serbian Tipsarevic won his previous two matches - against Lukas Lacko and Julien Benneteau - in five sets but was trailing 6-2 5-1 when he pulled out with a jarred heal.