Djokovic beat the Argentine 4-6 7-6 (8-6) 6-4 in a three-hour thriller in the final match of the day to set up a semi-final with another Argentine Diego Schwartzman.
The world number one saved two match points in a second set tiebreak before edging to victory in the final set after a match that brought out some scintillating tennis from both players.
'Medvedev's game is one-dimensional' - Tsitsipas 'surprised' at what US Open champion achieved
Djokovic will now meet Schwartzman on Saturday after the world number 24 beat Japanese sixth seed Kei Nishikori 6-4 6-2.
Defending champion Nadal set up a semi-final with Stefanos Tsitsipas thanks to a 6-4 6-0 win over fellow Spaniard Fernando Verdasco.
A week after losing to the Greek at the same stage of the Madrid Open, the 32-year-old Nadal will be eager to prove that defeat was just a blip as the Spaniard fine-tunes his game ahead of his bid for a 12th Roland Garros title.
The 20-year-old Greek progressed after Federer's withdrawal.
Nadal went 2-0 down against Verdasco before surviving three break points at 4-4 in the first set, but the second seed pulled away by winning eight consecutive games to continue his hunt for a ninth title in Rome.
"I was not playing badly at the beginning at all but he was playing unbelievable (tennis)," Nadal said.
"No mistakes, a lot of winners, taking the ball early. It was a very difficult first set. It was one of the first sets that I am happier with.
"I think I had a good feeling during the whole match. Then after winning that first set, in the second of course he slows down a little bit, but I was able to play a little bit more aggressive with the forehand.
"I did a lot of things well. I am very happy to be in the semi-finals again. It's a good victory."
'Looking very sharp!' - Federer helps Nadal with his suit at Laver Cup in 2019
‘Keep the points under five shots!’ - The time Nadal coached Federer at Laver Cup