Roger Federer is the Australian Open champion after beating Rafael Nadal 6-4 3-6 6-1 3-6 6-3 in Melbourne to capture his 18th major.
Federer and Nadal produced one of the most competitive contests their rivalry has ever seen but it was the Swiss that prevailed after three hours and 38 minutes on Rod Laver Arena.
It means Federer has secured his fifth Melbourne crown and a first grand slam success since Wimbledon in 2012.
The win also made Federer the first player ever to win five titles at three different grand slams and at 35, the oldest grand slam winner since Ken Rosewall won the 1972 Australian Open at 37.
If this was to be the last grand slam final duel between this pair, perhaps the two finest players the sport has ever seen, it was more than a fitting finale.
Nadal twice came back from a set down and then led by a break in the fifth but Federer drew on all his powers of brilliance to win one of the most unpredictable finals in recent memory.
The 35-year-old's achievement is all the more remarkable given he arrived here, having not played a single official match since Wimbledon, after taking the second half of 2016 off to recover from injury.
Federer had not expected to go past the fourth round but now he is the champion, capping a topsy-turvy tournament with arguably its greatest twist.
"Now we made it, we're going to be partying like rock stars tonight. I can tell you that," Federer said after the win.
"I think this one will take more time to sink in. When I go back to Switzerland, I'll think, 'wow'. The magnitude of this match is going to feel different.
"I can't compare this one to any other one except for maybe the French Open in 09. I waited for the French Open, I tried, I fought. I tried again and failed. Eventually I made it. This feels similar."
In his on-court speech, the 35-year-old cast some doubt as to whether he would return next year but later said uncertainty was only natural at this stage of his career.
"This is all about knowing that I have only so much tennis left in me," Federer said.
"If I do get injured, maybe if I miss next year, who knows what happens? Yeah I mean look, I've had a tough year last year. Three five-setters are not going to help.
"I just meant it the way I meant it. There wasn't something planned behind it, that this is my last Australian Open. I hope can I come back, of course. That's my hope right now."
Federer took a medical time-out at the start of the fifth set, just as Nadal looked to have the momentum behind him.
Pat Cash described it as "legalised cheating" in commentary but Federer insisted his need was genuine.
"I felt my quad midway through the second set already and the groin started to hurt midway through the third set," Federer said.
"I also think we shouldn't be using these rules or abusing the system. I think I've led the way for 20 years so I think to be critical there is exaggerating.
"I'm the last guy to call a medical timeout. So I don't know what he's talking about."
Nadal has now lost three times in the Australian Open final but the 30-year-old can take great comfort from his resurgence at this tournament.
The Spaniard will rise to number six when the world rankings refresh on Monday and, after ending last season early due to a wrist problem, he looks to be rediscovering his best.
"I have big personal satisfaction," Nadal said. "I feel happy.
"I played a great quality of tennis during the whole month that I have been playing. That's a great news for me.
"The only goal for me is to keep going. I believe that if I have my body in the right conditions, I can have a great year because I feel that I am playing well."