A pulsating tie went the way of Canada, who defeated Russia to ensure they will contest the Davis Cup final for the first time.
Gerard Pique has been criticised for his off-field commitments but said after Barcelona's win at Leganes that he has not been distracted.
Garbine Muguruza has turned to Conchita Martinez in a bid to return to the peak of her powers after splitting with Sam Sumyk.
Rafael Nadal helped hosts Spain see off Argentina in a deciding doubles contest, setting up a semi-final against Great Britain.
Serbia had hoped to mark Janko Tipsarevic's farewell by winning the Davis Cup, but Russia ruined those plans in Madrid on Friday.
Kyle Edmund will once again play in the singles for Great Britain, meaning Andy Murray will be a spectator for their quarter-final tie.
Andy Murray may not feature for Great Britain in Friday's Davis Cup quarter-final tie with Germany, according to captain Leon Smith.
Alex de Minaur's comeback win was not enough to inspire Australia, as Canada became the first team to book a semi-final berth in Madrid.
Spain will be without Roberto Bautista Agut for the rest of their Davis Cup campaign after the world number nine's father died.
Thanks to Novak Djokovic and Filip Krajinovic, Serbia reached the Davis Cup quarter-finals alongside Great Britain and Germany.