Nadal, who holds a record seven titles at the Foro Italico, overcame a poor first set and a partisan crowd to beat Fabio Fognini 4-6, 6-1, 6-2. Then, four-time Rome winner Djokovic rallied past Kei Nishikori 2-6, 6-1, 6-3.
Nadal and Djokovic have played each other 50 times but their last meeting came more than a year ago, when Nadal won in the Madrid Open semifinals.
"Tomorrow is going to be the ultimate challenge on clay," Djokovic said. "Beating Rafa is a really difficult thing to do on this surface. But, I've done it before."
Djokovic leads Nadal 26-24 overall, but Nadal holds a 15-7 advantage on clay.
Nadal can replace Roger Federer at No. 1 if he lifts the Rome trophy for the first time since 2013. Federer is sitting out the clay season to prepare for Wimbledon, where he will bid for a record-extending 21st Grand Slam title.
Djokovic, who is returning from a persistent right elbow injury, hadn't reached a semifinal since before Wimbledon last year.
"This is what I was looking forward to," Djokovic said. "This is what I was hoping to achieve."
In the other half of the draw, defending champion Alexander Zverev extended his winning streak to 12 matches with a 6-4, 3-6, 6-3 victory over ninth-seeded David Goffin. He'll meet Australian Open finalist Marin Cilic, who beat 10th-seeded Pablo Carreno Busta 6-3, 6-3.
Sharapova required more than three hours to eliminate last year's French Open winner, Jelena Ostapenko, 6-7 (6), 6-4, 7-5; and defending champion Elina Svitolina defeated Angelique Kerber 6-4, 6-4 for her sixth straight victory over the former No. 1 player.
Svitolina will next face 26th-ranked Anett Kontaveit of Estonia, who beat Australian Open champion Caroline Wozniacki 6-3, 6-1.
Sharapova's semifinal opponent will be Simona Halep, who advanced with a 6-2, 6-3 win over Caroline Garcia that ensures she will keep the No. 1 ranking for another week.
Djokovic has now won 12 straight matches over Nishikori and the Japanese player didn't help his cause when he landed an easy overhead into the net early in the third set. Still, it remained tight with long rallies until the end.
"It was a fantastic match," Djokovic said. "We went toe to toe until the last point."
Fans were decidedly behind Fognini, Italy's top player, and Nadal was under pressure when Fognini won five straight games to cancel out a 4-1 deficit and win the opening set.
"He played aggressive, a great level of tennis, creating a lot of winners and taking balls earlier," Nadal said. "I felt the pressure a little bit and played a couple of bad games."
But Fognini couldn't keep up with Nadal's consistency and heavy topspin on the red clay court and eventually was physically worn down.
"I tried to play more with my forehand and when I play aggressive with my forehand the backhand becomes better," said Nadal, who sat out earlier this season with right knee and hip injuries. "It's important to be able to change the tactics of the match."
Fognini had tape applied under his left knee while trailing 3-2 in the third set due to a physical problem that has bothered him for weeks.
"The first set lasted more than an hour," Fognini said. "It's him that causes the problem."
While the result meant it was now 42 years since an Italian man last won the tournament — Adriano Panatta in 1976 — Fognini was still applauded as he walked off of the court.
Nadal joined in the applause for Fognini.
More AP tennis coverage: https://apnews.com/tag/apf-Tennis
Andrew Dampf on Twitter: www.twitter.com/asdampf