Nadal (right) has now beaten Federer in 14 of their 21 meetings
Rafael Nadal beat Roger Federer 6-4 7-6 (7-5) to win the Madrid Open and make himself hot favourite for the French Open, which starts next week.
It was the first match between the arch rivals since last year's Masters Series final in Madrid, which Federer won.
Both players dropped serve early in the first set before the second-seeded Nadal broke decisively to lead 4-3.
In the second set, Nadal won a tightly contested tie-break after two breaks of serve each.
It was a record-breaking 18th Masters crown for the Spaniard and his victory extended his unbeaten run on clay to 15 matches this season.
Nadal, the four-time French Open champion, has now won 168 of 174 matches on clay since 2005.
The clay-court season will not be judged here but in Paris
He will return to number two in the world, behind Federer and above Novak Djokovic, in Monday's rankings after also winning in Monte Carlo and Rome and becoming the first player to win all three clay-court Masters titles in a season.
"Well to be the first player is unbelievable," said Nadal. "I would never have dreamed that I would be able to do so.
"I'm very happy to have won here and it is especially important to have won in Madrid. Beating Roger is always a special occasion. It's always a very difficult match."
World number one Federer, who has won 16 Grand Slam titles, took advantage of Nadal's fourth-round exit last year to clinch his first French Open crown.
"The clay-court season will not be judged here but in Paris," he said.
"We will see what happens in three weeks. I feel I'm ready for Paris. I felt a major improvement in my game compared to last week when I came here from Estoril.
"It's been a wonderful event for me. I'm sorry I couldn't defend the title. Rafa's had an incredible clay season, he was supreme today."
Nadal came into the match having beaten Federer in 13 of their previous 20 meetings and the home favourite drew first blood by taking an evenly fought first set.
Federer had chances to break in the second game but he failed to take them, and Nadal made him pay by immediately breaking the Swiss in the next.
However, Federer, 28, broke back immediately after taking full advantage of a triple break-point to level the scores at 2-2.
The next two games went with serve before Nadal made his second breakthrough in the seventh game following a fiercely fought battle that saw the left-hander earn four break points before finally putting the fifth one away.
Federer had a great chance in the 10th game after earning four break points, only to come up short as the 23-year-old Nadal took the set.
Nadal enjoyed the perfect start to the second set as he broke Federer in the opener, but the top seed again hit back immediately to level it at 1-1.
The next break came in the fifth game when second seed Nadal again got his nose in front, but once more Federer responded, breaking back to make it 4-4.
With neither player able to make any more dents on their opponents' serve, the set went to a tie-break.
Federer took the early initiative before Nadal hit back to secure the set, the match and the 39th title of his career, setting him up perfectly for an assault on a fifth French Open title.
"For me it's a dream to have won the three tournaments before Roland Garros," said the Spaniard. "I want to enjoy that now and we'll see what happens in two weeks.