Spain will play host nation Australia in semi-finals of the inaugural ATP Cup teams event, while Serbia, led by world number two Novak Djokovic, take on Russia.
World number one Rafael Nadal recovered from an upset loss against Belgium's David Goffin to win the deciding doubles match and send Spain into the semi-final of the ATP Cup teams event in Sydney in the early hours of Saturday.
Nadal partnered with Pablo Carreno Busta to win the high stakes decider 6-7(7), 7-5, 10-7 against doubles specialists Sander Gille and Joran Vliegen after Spain and Belgium split the singles results earlier in the evening.
Spain will now play host nation Australia in the inaugural event, while Serbia, led by world number two Novak Djokovic, take on Russia.
Nadal said it had been a difficult day playing in humid conditions in Sydney after an onerous tournament schedule meant the Spanish team had played its early matches on the other side of the continent in Perth.
"For me I was suffering a lot physically today," Nadal said shortly after winning the extended tiebreak that is used in place of a deciding third set at doubles matches at the ATP Cup.
"I was sweating a lot and lost my energy."
While mainly known for his singles success, which includes 19 Grand Slams, Nadal is a capable doubles player, having won the doubles Olympic Games gold at the 2016 Rio de Janeiro event.
He only had minutes to prepare for the decider after losing his singles match against Goffin 6-4, 7-6(3).
Goffin's impressive victory was built on the Belgian's attacking baseline game, where he proved to be one of the few players who can stand up to Nadal's heavy spin.
The pair have now played six times and despite trailing Nadal in their head-to-head 4-2, Goffin has won both times they have played on hard courts.
"I have to take the ball early to use the power of Rafa to play fast and make him run a lot," Goffin said after the match, played on the Sydney arena's blue plexicushion hard court.
Nadal appeared distressed during the match, which he later explained was due to a difficult schedule and hot Sydney day where temperatures reached 35 Celsius (95 Fahrenheit).
Djokovic survives to put Serbia in semis
In the day session, Serbia's Novak Djokovic battled through a stirring challenge from rising Canadian star Denis Shapovalov to propel his country into the semi-finals of the inaugural ATP Cup team event with a 4-6, 6-1, 7-6(4) victory.
It was Djokovic's fifth victory over the 20-year-old Canadian in as many clashes but by far the toughest, after Shapovalov controlled significant portions of the match played in Australia's intense summer heat.
The victory, set up earlier by Serbia's Dusan Lajovic's upset win over Canadian teenager Felix Auger-Aliassime 6-4, 6-2, means Serbia will play Russia in the semi-final. That clash will see Djokovic face world number five Daniil Medvedev, a player who has beaten the Serbian at their last two meetings.
Djokovic, ranked second in the world and peerless during his tour of Australia last year, knew he was in a battle early as he fought hard to hold his service games, while the left-handed Shapovalov swung the ball powerfully around the court.
The Canadian, ranked fourteen in the world, was rewarded with a break, and eventually the first set. He looked most likely to break serve again early in the second, while Djokovic was forced to simply hang on.
After more than a set of tennis, it was Shapovalov, and not Djokovic, who looked like a 16-times grand slam champion.
Djokovic, however, stayed in the match. He hit an awkward but accurate lob to stave off one break point early in the second set, and against all momentum, broke his opponent's serve.
The vocal Serbian supporters erupted. Shapovalov grew frustrated.
"It felt, not a little bit, fully like I'm playing at home," Djokovic said after the match.
In less time than it would take for a spectator to line up for a drink in the 35 Celsius (95 Fahrenheit) heat, Djokovic had won the second set 6-1.
Shapovalov composed himself for the third, and his prospects of upsetting the tour applecart, long dominated by Djokovic, Rafael Nadal and Roger Federer, improved.
At 185cm (6.1 ft), the young Canadian is around average height for a professional tennis player, but he looked like a giant. He bullied his more fancied opponent, using his single-handed backhand to push Djokovic into the side fencing.
After some late third set drama, where the two exhanged breaks of serve, the match fittingly entered into a tiebreak.
Shapovalov looked most likely -- but the Serbian had a joker up his sleeve he has successfully deployed over the years in tense situations.
He simply refused to miss, daring his younger rival to find a way to hit seven winners and claim the tiebreak.
It was too much for the Canadian, and, after floating a ground stroke long, Djokovic raised his arms in victory.
"The match was so close it could have gone a different way easily," Djokovic said in an on-court interview after the match.
Serbia joins Australia and Russia in qualifying for the semi-finals. The remaining quarter final, between Rafael Nadal's Spain and David Goffin's Belgium, is scheduled for Friday night in Sydney.