The Spaniard, 30, won 6-2 6-4 to claim his first victory over the Serb since the 2014 French Open final.
Nadal improved his record on clay this year to 14-0 and will face Austrian Dominic Thiem, who beat Uruguay's Pablo Cuevas 6-4 6-4, in Sunday's final.
Kristina Mladenovic plays Simona Halep in Saturday's women's final.
Nadal confirmed his return to form with a long-awaited win over Djokovic, his 24th in 50 career meetings.
"It is a great result," he said. "To win against Novak by that score you have to be playing very well, otherwise it's impossible.
"It was an important match for me. I lost a lot of times in a row. To break that means there are always nerves.
"The circumstances nowadays are completely different compared to those seven matches that occurred before.
"I think that the last two years perhaps haven't been my best two years. For Novak, they were really good years."
Djokovic, playing his first tournament since splitting with his long-time coaching team, won just four points in the opening four games as he fell 4-0 down to a rejuvenated Nadal.
There were more positive signs for the Serb in the second set as he recovered an early break of serve, punching his fist in delight, but Nadal would quickly re-establish the advantage.
The Spaniard came through a tense final game, fending off a break point before converting his third match point and closing on a fifth Madrid title.
"He deserved to win," said Djokovic.
"It wasn't a very high quality of tennis from my side. I made a lot of unforced errors.
"His quality was very high. He managed to do whatever he wanted really, especially in the first set."