Marin Cilic completed a dream week by steering Croatia into the Davis Cup World Group on Sunday but Spain found themselves out in the wilderness after crashing to defeat in Brazil.
Less than a week after winning the US Open, Cilic snatched the crucial fifth rubber of Croatia's World Group playoff tie against the Netherlands in Amsterdam, beating Thiemo de Bakker 6-7(4) 6-4 6-2 7-5 to complete a 3-2 victory.
Cilic, rested for the first singles, had won Saturday's doubles with Marin Draganja.
"It was extremely good tennis and I'm extremely happy to be back in the World Group with my team," Cilic said on court. "We have a young team and we're only going to be able to improve."
Almost unthinkably for a nation blessed with so many top 100 players, Spain will not be in next year's World Group after defeat against Brazil in Sao Paulo.
Roberto Bautista Agut's 6-4 3-6 6-3 6-2 defeat by Thomaz Bellucci means Spain will be missing from the elite for the first time since 1996.
They have won the title five times since 2000 but this year they have been weakened by the absence of Rafa Nadal and David Ferrer.
Croatia, the 2005 champions, and Brazil will be joined in the World Group by Belgium, Australia and the US who all triumphed at the weekend in their playoff ties against Ukraine, Uzbekistan and Slovakia respectively.
Canada also progressed to the World Group as Milos Raonic beat Santiago Giraldo in straight sets to give his side an unassailable lead against Colombia in Halifax.
This year's final will be between France and Roger Federer's Switzerland. France saw off defending champions Czech Republic while Federer gave the Swiss victory against Italy.