World number one Roger Federer survived one of the biggest tests of his career to beat Janko Tipsarevic in round three of the Australian Open.
Defending champion Federer needed four hours, 27 minutes to win 6-7 (5-7) 7-6 (7-1) 5-7 6-1 10-8 and set up a last-16 tie with Tomas Berdych.
Federer's bid for a fourth Australian title was under huge threat as the final set progressed.
But the Swiss remained solid on serve and got the vital break in game 17.
"I don't often get to play five-setters unless they're against Rafael Nadal at Wimbledon," said Federer. "It was good to be part of something like this - it was a great match.
"You feel the crowd's getting into it, the opponent is getting into it, and then things are just not happening for you. All the opportunities I missed put me under a lot of pressure.
"I was back against the wall and playing a guy who played fantastic tennis throughout the match.
"It was one of those days I just didn't feel that great but I fought hard and it's a good feeling coming back from two sets to one and winning like that in the fifth."
Federer missed 16 of 21 break-point opportunities, while his dogged opponent converted all three of his.
"Pity somebody has to win, wish we could have draws sometimes too"
With history beckoning every time Federer steps on the court, few could have predicted he would be be taken to the limit by world number 49 Tipsarevic.
The Swiss star has a third straight Australian title and fourth overall in his sights, as well as a potential 13th Grand Slam title as he closes in on Pete Sampras's record of 14.
But all that was on the line after he failed to serve out the first set from 5-3 and went on to lose the third.
He had levelled with a superb performance in the second set tie-break - his best sustained effort of the match - but lost the third despite having two set points on the Tipsarevic serve.
It went into a fifth set, unfamiliar territory for Federer so early in a Grand Slam, and both men focused superbly.
606: DEBATE
Tipsarevic refused to yield, saving two break points while serving at 2-2, before eventually slipping up in game 17.
He moved 40-0 clear but then faltered and, finally, Federer took advantage to break on his second opportunity as the Serb's volley was forced into the net.
"He's a nice guy - pity somebody has to win, wish we could have draws sometimes too," Federer added.
"He fought really hard, didn't miss much, and he was way better than back when I played him in Davis Cup and beat him quite easily. I was impressed by his game.
"This is where you get grey hair early in life. Pity for him, but what a great victory for me."
Tipsarevic said: "I went on court with the idea that I could win. I was close.
"Against Roger it's so hard, because he's playing every point. Even when you're up like 40-0, the game is far, far from over.
"I lost because he was better in the important moments of the match."
Berdych, the 13th seed, reached the fourth round with a 3-6 6-3 7-6 (7-5) 6-2 victory over Argentine Juan Monaco.