The United States survived a fright from little Latvia on Saturday before winning 3-2 in a Fed Cup qualifier as Serena Williams suffered her first career singles loss in the team event.
The United States seemed poised to advance to the finals after taking a 2-0 lead on Friday as Williams and Sophia Kenin won their respective singles matches in Everett, Washington.
But Jelena Ostapenko gave plucky Latvia a lifeline by beating newly crowned Australian Open champion Kenin 6-3, 2-6, 6-2 on Saturday.
A Latvia comeback loomed when World No 41 Anastasija Sevastova edged Williams 7-6(5), 3-6, 7-6(4) in a three-set thriller in the fourth rubber to even the tie at 2-2.
Coming into the match, Williams had a 14-0 winning singles' record at the tournament. Her loss meant a doubles match-up between Ostapenko and Sevastova and the well-rested Alison Riske and Bethanie Mattek-Sands would decide the tie.
And it as the Americans who prevailed, winning 6-4, 6-0 against their understandably tired rivals and saving the blushes of Williams and Kenin.
Switzerland, Spain, Belgium, Slovakia, Germany, Russia and Belarus also moved through to the inaugural 12-nation showdown in Budapest.
They will join France, Australia, Czech Republic and hosts Hungary in the revamped finals in April.
Earlier on Saturday, Canadian teenager Leylah Annie Fernandez caused a huge shock when she beat Swiss world number five Belinda Bencic in Biel but it proved in vain as Switzerland progressed.
A weakened Canada, without US Open champion Bianca Andreescu and Eugenie Bouchard for the singles, had trailed 2-0 after Friday's action. But 17-year-old Fernandez, ranked 185th in the world, beat Bencic 6-2, 7-6(3).
It was to be no fairytale comeback though as local favourite Jil Teichmann battled past another Canadian stand-in -- doubles specialist Gaby Dabrowski -- 6-3, 6-4 to wrap up a 3-1 win.
Spain raced into the Fed Cup Finals as Carla Suarez Navarro claimed the winning point at La Manga Club against Japan.
The five-times winners led 2-0 overnight and the 31-year-old Suarez Navarro wasted little time finishing off Japan as she swept past Kurumi Nara 6-1, 6-3 on the outdoor claycourt.
Nara, ranked 137 by the WTA, was a late stand-in as Japan's number one Naomi Osaka did not take to the court after her dismal defeat by Sara Sorribes Tormo on Friday.
Four-times winners Russia edged out Romania in Cluj as Anna Blinkova and Anna Kalinskaya won the deciding doubles rubber against Jaqueline Adina Cristian and Elena Gabriela Ruse.
Belgium and Kazakhstan were locked at 1-1 overnight, but Elise Mertens beat Yulia Putintseva 6-1, 7-6(1) before Kirsten Flipkens secured the winning point by beating Zarina Diyas, also in straight sets in Kortrijk.
Germany were far too strong for Brazil in Florianopolis where Laura Siegemund recorded her second win of the weekend to give her side an unassailable 3-0 lead.
Slovakia ended Britain's hopes in Bratislava, where Heather Watson's win in the third rubber had given the visitors a lifeline. But Anna Karolina Schmiedlova battled past Harriet Dart to finish off the tie.
Belarus squeezed past the Netherlands 3-2 after Aliaksandra Sasnovich and Aryna Sabalenka beat Kiki Bertens and Demi Schuurs 4-6, 6-3, 7-6(8) in the final doubles thriller.
The Fed Cup has followed the men's Davis Cup competition by adopting a multi-nation finals tournament in one city, with 12 teams set to assemble at the Laszlo Papp Budapest Sports Arena in April.
As well as trying to increase the exposure of the women's team event run by the International Tennis Federation, the extra TV revenue means an $18 million prize fund of which $12 million goes to the players and the other $6 million to the federations.