The 13-time Roland-Garros champion won the pair's 59th career meeting 6-2, 4-6, 6-2, 7-6 (7/4) after a four-hour-and-12-minute quarterfinal on a raucous Court Philippe Chatrier.
Nadal sealed his eighth victory in 10 Roland-Garros matches against last year's winner Djokovic at 1:16 am local time to set up a last-four clash with third seed Alexander Zverev on Friday.
"I'm very emotional. For me it's incredible to play here," said Nadal.
"Playing against him is always an amazing challenge... To win against Novak, there is only one way, to play your best from the first point until the last."
The 35-year-old has lost just three of his 113 matches on the Paris clay since his 2005 title-winning debut and now only trails Djokovic 30-29 in their career head-to-head.
The Spaniard, seeded fifth, remains on course for a record-extending 22nd Grand Slam title after lifting this year's Australian Open, which Djokovic missed after being deported from the country over his Covid vaccination status.
Djokovic overturned a double-break deficit to take an 88-minute second set and missed two set points when serving for the fourth to force a decider.
The world No 1 will rue those missed chances while he waits until Wimbledon for his next opportunity to take his Slam tally to 21.
"Congratulations to Rafa, he was better in the important moments," said Djokovic.
"He showed why he was a great champion. Well done to him and his team, he deserves it."
Nadal was a slight underdog heading into the match after being taken to five sets in the previous round by Felix Auger-Aliassime and he had even hinted it could be his last appearance in Paris due to a persistent foot injury.
The colder, slower conditions of the night session were also expected to favour Djokovic.
But the 'King of clay' smashed 57 winners in a trademark performance to delight the crowd as he gained revenge for his semifinal loss to the same opponent 12 months ago.