The Briton had never beaten Nadal in six previous meetings on the surface but won 6-3 6-2 to stun the home crowd.
Defending champion Nadal was aiming for a record fifth win in Madrid but Murray outclassed his Spanish opponent to lift his first Masters title on clay.
The 27-year-old, who won his first clay-court title in Munich on Monday, has now secured two in under a week.
"It's one of the hardest things in tennis to try and win against Rafa on clay, so I'm glad I've managed to do it," Murray told Sky Sports.
"I made very few errors and changed the height of the ball extremely well, which was part of the reason why he was mistiming a few shots.
"I used the second serve into the forehand a lot and that worked well because I was able to get him moving. I dealt with all of the nervy moments I had in the match pretty well."
Nadal had reached the final without dropping a single set, showing signs of his best form ahead of the French Open later this month.
But defeat means he slips to seventh in the world rankings, the first time he has been outside the top five in a decade.
The Mallorcan will be aiming for a 10th title at Roland Garros, but on the evidence of Murray's performance in Madrid, the Scot will be just as strong a contender.
"I have played well at Roland Garros in the past," Murray said. "Last year my game was not ready to win, whereas the previous time against Rafa there I played well. I don't think I would go into the French as one of the favourites but if I play like that I'll give myself an opportunity."
Full of confidence following his triumph over Philipp Kohlschreiber at the Munich Open on Monday, Murray started brilliantly to win 12 of the first 14 points and establish a 3-0 lead.
Murray was powerful, patient and aggressive but still had to defend three break points on his way to taking the first set.
Despite signs Nadal was recovering his composure, Murray broke again immediately in the second, showing the same focus and determination that epitomised his powerful start to the match.