Spain survived a major scare to complete a 3-2 victory over Argentina and set up a Davis Cup final showdown against Australia.
Spain went into the final day leading 2-1 but were rocked by Agustin Calleri's remarkable 6-4 7-5 6-1 victory over world number one Juan Carlos Ferrero.
It was left to Carlos Moya to snuff out Argentine hopes with a crushing 6-1 6-4 6-2 success against Gaston Gaudio in the deciding singles rubber.
Spain beat Australia in the final in Barcelona in 2000 to win the Davis Cup for the first time but the Australians will
have home advantage this year.
Australia had Lleyton Hewitt to thank for their victory over Switzerland.
The former world number one recovered from two sets down to beat Wimbledon champion Roger Federer 5-7 2-6 7-6 (7-4) 7-5 6-1 and give his country an unassailable lead.
Federer, who outplayed Hewitt in the opening two sets, served for the match at 5-3 in the third before the Australian broke back to spark his remarkable comeback.
Hewitt went on to break Federer's serve twice in the fifth set as the world number three began to tire in his third match in three days.
"It's an incredible feeling, coming back from two sets down," said Hewitt, who was lifted high into the air by Australian captain John Fitzgerald after his win.
"I was a little bit nervous and tight at the beginning and he was pretty much unstoppable in the second set.
"Everyone knows how passionate I am about Davis Cup. To be standing there and serving for the match like I was tonight is an unbelievable feeling."
The 22-year-old said he drew inspiration from Pat Cash's 2-6 4-6 6-3 6-4 6-3 win over Sweden's Mikael Pernfors to clinch the Davis Cup in 1986.
"I think I know every shot in that match," said Hewitt.
"The way he came back was incredible. I just tried to hang in there. This beats the hell out of winning the US Open and Wimbledon."
It was Federer's first loss in 11 Davis Cup singles rubbers, nine of which were straight-set victories.
After Hewitt's win on Sunday, Australia opted to use Todd Woodbridge for the dead singles rubber against Michel Kratochvil.
Woodbridge retired after losing the first set 6-4, making the final score 3-2 to Australia.