Roger Federer put his best fighting tennis on display to produce a 3-6, 7-5, 7-5 victory over Tomas Berdych on Sunday to capture a third Madrid Masters title and depose Rafael Nadal as world number two.
The Swiss, with 16 Grand Slam titles, will now stand behind Novak Djokovic on Monday on the ATP list after sending Nadal back to third with his winning performance on the controversial blue clay laid down at the Caja Magica.
"I feel amazing," said Federer, who came through on his fourth match point as Berdych ploughed a forehand into the net.
"This is a tough tournament and a brutal draw. I'm playing well and I'm so happy to win this once again."
The 30-year-old went level with Nadal on 20 career titles at Masters 1000 level, with both men sharing the overall record.
Federer, playing in his 104th ATP final, won his 74th title and fourth of the season.
He now stands 11-4 in head-to-head encounters with Berdych, who had beaten him in three of their five most recent matches.
But Federer was having no more of that scenario as he turned in victory in just over two and a half hours with a dozen aces, 44 winners and 30 unforced errors.
Berdych saved three match points in the final game before going down.
"We both played a nice match, but Roger showed why he's the star," said the Czech. "He was able to win in the conditions, it was well done."
Berdych claimed the first set as he dominated with 14 winners and two unforced errors, only to quickly find himself on the other end of a Federer fightback in the second.
The Swiss third seed missed on a set point while serving at 5-3 to level, but stayed in the chase, finally taking the set 7-5 as Berdych double-faulted on set point.
In the third, Federer rallied from 0-30 in his first three service games, then moved into position with a break for 5-3, which was finally achieved after Berdych saved three break points with consecutive aces but then sent over two double-faults in a row to give away the game.
Federer still could not close as he was broken in the next game, 5-4.
The Swiss hung through the next two games on serve before finally putting away the win on his fourth match point.
"It's a great feeling to win any event, but especially another here in Madrid," added Federer.
"This is a tough tournament. It was tough to move on the clay but you just get on with it and try to make the best of the situation.
"The level of play was good this week and I'm looking forward to the next few weeks."
In an unexpected post-match ceremony, American film star Will Smith came down from his spectator position to present the winner with the suit he wore in his latest Men in Black film.
The American also said a few words to the delighted crowd in Spanish.