The victory gives Federer his first title since Basle in October
World number two Roger Federer finally ended Rafael Nadal's superb run on clay to win the Madrid Open and take his first title of the year.
The Swiss came through 6-4 6-4 in one hour 26 minutes for only his second win against Nadal in 11 attempts on clay.
Nadal needed four hours to win an epic semi-final against Novak Djokovic on Saturday, and looked flat in the final.
But Federer was clinical throughout until nervously fending off two break points when serving for the match.
The defeat is only Nadal's fifth on clay in 155 matches since 2005, brings an end to his run of 33 consecutive victories on the surface, and takes the head-to-head record against Federer to 13-7 in the Spaniard's favour.
I'm very, very happy that I stayed positive and I got the win I needed badly
It also gives Federer and the other leading men hope going into the French Open, which begins next Sunday, but the Swiss does not expect four-time champion Nadal to be overly worried by a rare defeat.
"I don't think he's going to take any damage away from this," said Federer. "I'm sure he's going to be rock solid in Paris again."
Nadal insisted: "Playing four hours was not a problem for today. Roger was much better than me and deserved to win."
Federer's only previous win over Nadal on the surface came two years ago in Hamburg, renowned as the fastest of the major clay tournaments.
Madrid replaced Hamburg in the schedule this year and also took on the mantle of fastest clay event because of the Spanish capital's high altitude.
There was no sign of the extra pace helping Federer in the early stages of Sunday's final as he held off two break points in his first three service games, but the Swiss worked his way into the match and earned a break point of his own at 4-4.
Nadal faltered first in a tight rally, hooking a poor backhand into the net to give a pumped up Federer the initial breakthrough and the Swiss served out the set to love in 40 minutes.
And the home crowd was stunned into almost total silence when Federer earned another break point at 2-2 in the second with a superb drop shot, before Nadal sent a backhand long to fall behind again.
The Swiss calmly served his way towards victory until a nervous final game, which saw Nadal make two errors on break-back points before Federer netted a volley on his first match point.
Unlike in Saturday's semi-final, when Nadal saved three match points, there was to be no comeback this time as Federer slammed down an ace on his second match point.
"I thought I took all the right decisions today and in the end it looked pretty comfortable so it was a perfect win for me," Federer said afterwards.
"I'm very, very happy that I stayed positive and I got the win I needed badly because I've had some rather bad losses this year. It's very satisfying."
Madrid was hosting the high-profile clay-court tournament for both men and women for the first time, but some players complained about the standard of the practice courts and dressing rooms at the much-heralded new Magic Box facility.
Tournament promoter Ion Tiriac said: "It's my fault the courts are not perfect. I hope next year the courts are going to be perfect.
"There was also a big discussion about dressing rooms. Up to a certain point they are right. My fault again.
"Give me two years and we'll discuss once again. Definitely whatever is wrong just throw it back to me."