Roger Federer survived an epic battle with Rafael Nadal to win the Nasdaq-100 Open final 2-6 6-7 7-6 6-3 6-1.
The Spanish 18-year-old took the opening set in Miami with ease and fought back from a break down to win the second 7-4 in the tie-break.
But it was the Swiss who produced some brilliant tennis when it counted in the tense third, taking the tie-break 7-5.
Federer was back at his best to level the match 2-2 and broke a tiring Nadal three times to close out an epic match.
"I really didn't expect to turn it around really," admitted Federer after the marathon match, which lasted three hours and 42 minutes.
"I haven't dug out many matches in my career and to dig it out against Nadal, I'm extremely happy - and exhausted."
The normally mild-mannered Federer lost his cool at one stage and threw his racket in frustration.
"I was missing one opportunity after another. I just had enough. I threw it hard. Maybe it did me good, who knows?"
Nadal refused to be too downcast after losing to Federer.
"It was a very equal match," said the Spanish teenager. "In the end it didn't happen for me."
Nadal is tipped to have a promising future
It was only the second time in Federer's career that he has successfully come back from two sets down to win a match.
And that looked a distant possibility as Nadal roared to two sets and 4-1 up in the Florida sunshine.
The Spaniard, known as "the prodigy," had taken the opener without facing a break point.
In the second, he showed his fearsome qualities as he recovered from a break and then 15-40 down to put the set back on level terms as Federer looked out of sorts.
Nadal took the tie-break when Federer netted a forehand and appeared to have his first Masters title in his sights as he went 4-1 up in the third.
But the Wimbledon and US Open champion drew on his mental reserves, keeping his cool to force the breaker.
Federer then unleashed his trademark flurry of forehands to win the third before taking just 30 minutes to win the fourth.
Nadal faded badly in the deciding set, Federer claiming his first Miami Masters Series title and extending his winning streak to 22 consecutive matches.
But the Spaniard will be one of the favourites for the French Open, which starts on 27 May.
"I've been playing very well and it gives me loads of confidence for the clay season," he said.