Melbourne: Roger Federer won his 18th Grand Slam title and put some extra distance on the all-time list between himself and Rafael Nadal, the man he beat 6-4, 3-6, 6-1, 3-6, 6-3 in a vintage Australian Open final on Sunday.

It was the 35-year-old Federer's fifth Australian title, his first at a major since Wimbledon in 2012, and it reversed the status quo against his nemesis, Nadal.

Federer had lost six of the previous eight Grand Slam finals he'd played against Nadal, and had only previously beaten the left-handed Spaniard in 11 of their 34 matches.

Both players were returning from extended layoffs for injuries — Federer the left knee; Nadal the left wrist — and were seeded 17th and ninth respectively.

Nadal remains equal second with Pete Sampras on the all-time list, with the last of his 14 majors coming at Roland Garros in 2014.

After four sets where the momentum swung alternately from one player to the next, the fifth had all the tension and drama that these two players are famous for.

Nadal went up an early break and it seemed as if the injury time-out Federer needed after the fourth set may have been an indicator of things to come.

But the Swiss star rallied, and broke back in a pivotal sixth game and took control in a period when he won 10 straight points.

Nadal saved three break points in the eighth game but lost momentum again when Federer finished off a 26-shot rally — the longest of the match — with a forehand winner down the line.

Consecutive forehand errors gave Federer the pivotal break for 5-3, but Nadal made him work for the very last point.

Serving for the match, Federer had to save two break points with an ace and a forehand winner.

At deuce, he was called for a double-fault but challenged the out call on his second serve. The call was overturned, and he got to play two.

Not long after, he fired an ace to get his second match point and hit a forehand crosscourt winner to finish off.

His celebrations were delayed, though, when Nadal challenged the call. Federer watched the replay on the tournament screen, and leaped for joy when it showed his last shot was in. His 100th match at the Australian Open ended with his fifth title at Melbourne Park.

No two players had met more often in Grand Slam finals in the Open era, and Nadal had previously dominated. But they hadn't met in a major final since the 2011 French Open, won by Nadal.

Three months ago, they were both on breaks when Federer joined Nadal in Mallorca for the opening of the Spaniard's tennis academy and the pair joked about ever being able to contend for majors again.

Yet here they were, first Grand Slam tournament of the season, renewing the classic rivalry that saw them dominate tennis a decade ago.

The long-odds final — No. 9 against No. 17 — unfolded after six-time champion Novak Djokovic was shockingly upset by No. 117-ranked Denis Istomin in the second round and top-ranked Andy Murray, a five-time losing finalist in Australia, went out in the fourth round to left-handed serve-volleyer Mischa Zverev.

Federer beat Zverev in the quarterfinals and U.S. Open champion Stan Wawrinka in an all-Swiss semifinal to reach the championship match. The six years between his Australian titles set a record, too, longer than the five years that both Boris Becker and Andre Agassi had between championships in Melbourne.