Rafael Nadal put in some late-night overtime to drag hosts Spain into the Davis Cup semi-finals but Novak Djokovic's hopes were dashed in excruciating fashion as Serbia bowed out on Friday.
World No.1 Nadal rescued his country as he joined forces with Marcel Granollers to win the deciding doubles rubber of their quarter-final against Argentina and set up a clash with Britain who beat Germany 2-0.
The 33-year-old Nadal had earlier thrashed Diego Schwartzman 6-1 6-2 to claim a 26th successive singles win in the competition, cancelling out compatriot Pablo Carreno Busta's 6-7(3) 7-6(4) 6-1 defeat by Guido Pella.
Nadal took charge as the Spaniards broke early in the decider to get home 6-4 4-6 6-3 and keep Spain on course for a first title since 2011.
An extraordinary quarter-final between Serbia and Russia went to the wire - Andrey Rublev crushed Filip Krajinovic 6-1 6-2 then Djokovic levelled the scores with a 6-3 6-3 win over Karen Khachanov.
Like his great rival Nadal later, Djokovic returned to court alongside Viktor Troicki to try and get his nation across the line.
Djokovic was battling an elbow injury but after losing the first set against Rublev and Khachanov, he and Troicki clawed their way back. Three times Serbia had match points in the deciding set tiebreak and on the third Troicki fluffed the easiest of volleys -- a mistake of nightmares.
When Troicki then failed to make a return it was the Russians who were celebrating a first semi-final since 2008 in which they will face Canada in Saturday's first semi-final.
For the second day running British captain Leon Smith elected to leave out talisman Andy Murray, the hero of the 2015 title campaign. But they are no one-man team these days.
Murray's replacement Kyle Edmund stepped up to beat Philipp Kohlschreiber 6-3 7-5 before Dan Evans, cheered on by a healthy band of flag-waving Brits, held his nerve to beat big-hitting Jan-Lennard Struff 7-6(6) 3-6 7-6(2).