Earlier, Canada reached the Davis Cup final for the first time in their history by winning a similarly thrilling tie against Russian Federation.
Britain meanwhile eased into the semis with an efficient 2-0 effort over Germany.
Canada beat Russian Federation in the first semi-final in Madrid's Caja Magica on Saturday, with Britain up against Spain later.
Nadal tallied a singles win and partnered with Marcel Granollers to a doubles victory in the country's 2-1 triumph against Argentina.
"It was a must-win match, nothing else mattered", the top-ranked Nadal said.
"We have an opportunity to finally have a great competition", Nadal said.
Madrid will host the Davis Cup finals again in 2020 and could do a third year, even if the legitimacy of the competition might benefit from a rotating venue.
Guido Pella began on Friday evening by rallying past Pablo Carreno Busta 6-7 (3), 7-6 (4), 6-1. Then the Serbs disregarded three match points in the tie-breaker, most agonisingly when Troicki disregarded an effortless volley for victory.
"It hurts really badly", Djokovic said.
Lexus UX 300e revealed, is brand's first ever electric vehicle
Lexus claims the battery needs seven hours to charge from a 6.6-kW household socket or 50 minutes using a 50-kW fast charger. Paddle shifters can be used in a similar manner to engine braking, providing four levels of deceleration regeneration.
"You might dream of going all the way to celebrate a victory, but sometimes that's not what you want it to happen".
Like his great rival Nadal later, Djokovic returned to court alongside Viktor Troicki to try and get his nation across the line.
"Both teams had a lot of chances", said Rublev, who won the opening singles against Filip Krajinovic 6-1, 6-2.
After a discover about-noticed match of excessive drama the Russians came out 6-4, 4-6, 7-6 (10/8) winners and face Canada, quarter-final victors over Australia, in Saturday's semifinals.
Ten-time champions France, runners-up in 2018, bowed out in the group stage. Cramming 25 ties into a venue with only three match courts was always going to be a challenge and teams will insist on changes next year to avoid the situation that saw the last rubber between the United States of America and Italy end at 4.04am.
"I've never lived such a moment in my career, in my life", Trooky told the media. "And I let my team down, and I apologize to them".
The second set was a tighter affair initially with the scores level at 3-3, but it was Djokovic who broke away - on a day where his service game impressed (11 aces) - and emerged victorious. He also requested medical assistance on his right arm. It was runner-up once since then, in 2013. Kyle Edmund first dispatched Philipp Kohlschreiber 6-3, 7-5 before Daniel Evans sealed it with a 7-6 (6), 3-6, 7-6 (2) win over Jan-Lennard Struff.
For the second day running British captain Leon Smith elected to leave out talisman Andy Murray, the hero of the 2015 title campaign. It was playing on two days' rest, while Serbia played on Wednesday and Thursday. He says that's how he's feeling.