The Czech world number six rallied from 2-6 2-5 down to pull off a battling 2-6 7-5 6-4 win over the world number one and top seed in two hours and 22 minutes.
It was Berdych's first win over Djokovic since the 2010 Wimbledon semi-final, and only his second in 15 attempts.
"I lost concentration and started to play more defensively," the Serbian said on the ATP website.
"(I played) a bad game at 5-3 and I made some unforced errors. At this level you have to take advantage of the opportunities and I lost this game by myself."
Things will not get any easier for Berdych, with Nadal, eyeing his third straight title after victories in Barcelona and Madrid, next up, the seven-time French Open champion seeing off fellow Spaniard David Ferrer 6-4 4-6 6-2 in their quarter-final.
And Roger Federer also made it through to the last four after he beat Poland's Jerzy Janowicz 6-4 7-6 (7/2), coming from a break down in the second set.
But Berdych was just delighted to have broken his hoodoo against the world's top player.
"One day you have to break (the run) and I am happy that it was today," he said.
"It was a great game and I am happy. I was trying to stay positive from the beginning. He didn't give me a single chance.
"I was trying to stay there and there are matches when you don't get a single chance, but then if you get one then you are ready. Then everything could turn the other way and this is what happened."
Nadal, who had to recover from a nightmare first set, losing it 6-1, to see off Latvian qualifier Ernests Gulbis last time out, was again taken the distance, getting another workout from a player he also beat in the last eight in Madrid.
Ferrer, trying to stay ahead of Nadal at number four in the world rankings, was two points from victory at one point in the Spanish capital, and he again gave Nadal another scare here before the clay court master prevailed.
"I played a great match against a difficult opponent," Nadal said.
"In the worst moment in the third set, I played my best tennis and I am happy. He is a fantastic player and a big example for the kids (on being) positive, fighting and correct on the court. This victory for me is very special."
Federer will play Frenchman Benoit Paire next after he wasted no time dispatching Spain's Marcel Granollers 6-1 6-0.
In the women's draw Women's world number one Serena Williams breezed into the last four in just 56 minutes with a 6-2 6-0 win over Carla Suarez Navarro of Spain.
Next up for Williams will be Romanian qualifier Simona Halep, who continued her fine run with a gutsy 4-6 6-0 7-5 win over Serbia's Jelena Jankovic.
Maria Sharapova, though, has withdrawn from the Rome event due to illness, sparking fears over the defence of her French Open title.
Sharapova, a former two-time winner in Rome, announced her decision to pull out prior to her scheduled meeting with Italian seventh seed Sara Errani.
Sharapova wrote on her Twitter feed: "I'm sorry for having to withdraw from the tournament this morning. Didn't recover after being sick last week and it got me again last night."
Errani will now play Victoria Azarenka after the Belorussian survived a second-set scare to see off Australia's Samantha Stosur 6-4 1-6 6-3.