Australian Open final Coverage: Watch highlights of the final on BBC Two from 13:00 GMT.

Roger Federer won his sixth Australian Open and 20th Grand Slam title with a five-set victory over Marin Cilic.

The Swiss lost five games in a row as he dropped the fourth set but recovered to win 6-2 6-7 (5-7) 6-3 3-6 6-1.

Federer, 36, becomes only the fourth player after Margaret Court, Serena Williams and Steffi Graf to win 20 or more major singles titles.

"It's a dream come true and the fairytale continues," said Federer, who has won three of the last five majors.

The final was played under the Rod Laver Arena roof as the tournament's extreme heat policy was invoked.

Despite starting at 19:30 local time in Melbourne, the conditions were if anything more testing than 24 hours earlier, when Caroline Wozniacki and Simona Halep played to the point of exhaustion in the women's final.

With the roof closed and air-conditioning taking the edge off the temperature, Federer and Cilic played out a gripping contest over three hours and two minutes.

After a poor start, Cilic looked to have the momentum when he won five games in a row to force a fifth set, but Federer clung on to his serve at the start of the decider and got the key break in the following game.

The Swiss ties the record for men's Australian Open titles at six with Novak Djokovic and Roy Emerson, and moves four clear of Rafael Nadal in the all-time list for male Grand Slam champions on 20.

"I'm so happy, it's unbelievable," Federer added. "After the year I had last year, it's incredible."

Federer holds off Cilic fightback

Cilic, 29, had come into the final brimming with positivity after an impressive run to the final that included a quarter-final win over Nadal, but he made a desperate start.

He won just four points in losing the opening four games, and Federer fired down back-to-back aces on his way to serving out the set after 25 minutes.

The Swiss saw off two break points early in the second, roaring "come on!" as he pulled a forehand winner down the line, and then resumed his assault on the Cilic serve.

Three break points were saved, the third with a second-serve ace, as Cilic edged his way into a tie-break and a chance to claw his way back into the match.

The 2014 US Open champion did just that after a huge cross-court forehand brought up two set points, and he smashed away the second to level.

Federer appeared to have regained control when a deep return drew an error as he broke for 4-2 in the third, and a fabulous half-volley pick-up said the confidence was flowing as he moved ahead again.

With a point for a double-break early in the fourth, Federer appeared as good as home, but his first-serve began to falter and Cilic ripped into the second serve with his huge forehand.

Cilic fought hard to take the match into a fifth set

After two hours and 10 minutes he finally broke the Federer serve, and a jolt of adrenaline coursed through the Croat - and the crowd - as this unexpected fightback took him to two sets all.

Federer was now struggling to contain the world number six, and was relieved to see a return hit the net on break point at the start of the fifth, before roaring as a serve saw off a second chance for the Croat.

The Swiss had halted the momentum and in the next game he grabbed it for himself with a deep, fizzing return that Cilic could not handle.

Nerves were still apparent as the eight-time Wimbledon champion urged himself on during the changeover, but he was not about to let his opponent back in, and another break of serve all but made sure.

There was time for one more moment of uncertainty for Federer when, just as in last year's final, he was forced to wait on match point for Hawk-Eye to confirm that he had indeed retained the title.

Roof closed in testing conditions

The decision before the match to keep the roof closed was greeted with surprise by those in Rod Laver Arena.

As forecast, the temperature in Melbourne during Sunday reached a very testing 37.5C, but that was below the 41C experienced earlier in the tournament, when the extreme heat rule was not involved.

However, the rule is not purely based on ambient temperature, but also other factors such as humidity, wind speed and angle of sun, known as the Wet Bulb Globe Temperature (WBGT).

"The tournament referee made this decision based on qualified and professional advice from the Bureau of Meteorology who are on site, and the tournament's chief medical officer," read a Tennis Australia statement.

"At no other time during the event this year has the WBGT reading reached the threshold."

What the BBC commentators said

Former Wimbledon champion Pat Cash on Radio 5 live: "It was a good performance from both players. You've got to hand it to Cilic, he had to play his best tennis and keep it up. That was the problem.

"Federer was consistent the whole way through. Other than a few double faults and a few patches, it was good consistency."

BBC tennis correspondent Russell Fuller: "Federer has previously won 19 of these, but he has a look of a man who's never done it before. He may be 36, but he shows no sign of ageing. He's proved yet again he's too good for the rest of the world."

Match stats

Federer Cilic 24 Aces 16 4 Double faults 5 6/13 Break points won 2/9 14/18 Net points won 14/19 41 Winners 45 40 Unforced errors 64 152 Total points won 128 Match duration: Three hours, three minutes

Federer's route to the title