Roger Federer came back from two sets down for only the third time in his career to lift the Nasdaq-100 Open title with a thrilling 2-6, 6-7, 7-6, 6-3, 6-1 victory over Rafael Nadal in Miami on Sunday.
Nadal threatened to snap the Swiss world number one's impressive record of 17 straight final victories when he grabbed the first two sets in a high-quality contest.
Federer wasted set points in the second set but he made no mistake in the third, frustrating the Spanish 18-year-old with a series of blistering winners to take the tiebreak 7-5.
"To dig it out in that final against Nadal when he was playing so well, I'm absolutely delighted," Federer said after picking up his $533,350 winner's cheque.
"It was extremely close today and I consider myself lucky to get through. He started so well.
"It was tough to get my rhythm against him but all my praises go to him. He's a great guy and great player."
Federer's only defeat of the year was in the semi-finals of the Australian Open, where he was beaten by eventual champion Marat Safin.
The last man to beat Federer in a final was Czech Jiri Novak in July 2003 in Gstaad, a week after the Swiss had won his first Wimbledon title.
Sunday's victory marks the first time Federer has won back-to-back Masters Series titles and he is only the sixth man to win successive titles in Indian Wells and Miami.
Federer's 27 titles to date includes six Masters Series crowns and four Grand Slam trophies.
There was some consolation for Nadal even though he was visibly disappointed at letting the title slip away from his grasp.
His run to final ensures he break the top 20 in the rankings for the first time in his career when the standings are released on Monday.
"It was a very equal match. In the end it didn't happen for me," Nadal said in Spanish.
"I've been playing very well and it gives me loads of confidence for the clay season. I really hope it's not my last final in Miami."
UNCHARACTERISTIC ERRORS
The 13,221-strong crowd backed Nadal from the start as he raced to a two-set lead and went 4-1 up in the third.
Federer appeared hampered by blisters on his foot during the early stages of the match and had to consult ATP trainer Bill Norris.
Despite dry, windless conditions, Federer began the match playing below the standard he set in his straight sets rout of Andre Agassi in the semi-finals.
His forehand and volleys were both missing their mark and he notched an uncharacteristic 20 unforced errors in the first set.
The serve, too, proved fallible and he was broken in the opening game of the contest and again in the seventh game.
A nerveless Nadal served out to take the first set after 32 minutes.
After the pair exchanged breaks at the start of the second, Federer began to lift his game and led 5-2 only to be pegged back by brave and obstinate play from Nadal.
The Spaniard saved two set-points at 4-5 before taking an early lead in the tiebreaker which he refused to relinquish.
After dropping his serve in the third set, Federer broke back but wasted numerous chanced to break again.
The Swiss showed uncharacteristic signs of frustration and threw his racket to the ground after Nadal held to go 5-4 up.
Nadal twice lead in the tiebreaker, coming within touching distance of the trophy only for Federer to dig his way out of trouble with his audacious forehands.
The Swiss took the set when a Nadal backhand sailed long in what proved to be the turning point in the match.
Having won the third set, Federer found his rhythm and his forehand became increasingly dangerous.
An early break in the fourth set ensured a deciding set and with Nadal's self-belief draining away, Federer assumed control in the fifth.
He swept to victory after three hours and 42 minutes, greeting the moment with clenched fists.