Spain will meet France in the semis after the holders reached the last four for a third year in a row with Lucas Pouille fighting back to beat Fabio Fognini and clinch a 3-1 victory over Italy.
David Ferrer toppled Philipp Kohlschreiber in a thrilling five-hour marathon decider as Spain roared back from 2-1 down in their Davis Cup tie against Germany to reach the semi-finals on Sunday.
After world number one Rafael Nadal put Alexander Zverev firmly in his place with a 6-1, 6-4, 6-4 humbling, Ferrer edged Kohlschreiber 7-6(1), 3-6, 7-6(4), 4-6, 7-5 in the final rubber at Valencia's sun-drenched Plaza de Toros to wrap up a 3-2 victory.
The 36-year-old Ferrer held firm in the eighth game of the final set to save three break points and then pounced at 5-5 to secure the break before serving out for victory.
"It's an unforgettable day, I don't know how I did it," an emotional Ferrer told Television Espanola.
Spain captain Sergi Bruguera added: "I feel so much emotion. The match that they both played was unbelievable. This is very special for David who we all love. He is one of the greatest people on the circuit and he deserves a match like this.
"I think both deserved to win. I think Philipp played one of the best matches I have ever seen him play. The match was an incredible level of tennis and incredible intensity."
Spain will meet France in the semis after the holders reached the last four for a third year in a row with Lucas Pouille fighting back to beat Fabio Fognini 2-6, 6-1, 7-6(3), 6-3 in Genoa and clinch a 3-1 victory over Italy.
Fognini missed two chances to take the third set, failing to serve out at 5-4 and then wasting a break point in the 11th game. It prompted the fiery Italian to smash his racket in frustration.
French number one Pouille overpowered him in the tiebreak before comfortably sealing the fourth set.
"I am very proud of the team and I am really relieved because the last match was so close," France captain Yannick Noah told the competition's official website.
"It came down to a few points in the third set. I think we have been a little lucky but it's part of the process and we enjoy our luck."
Croatia also made it into the last four as Australian Open runner-up Marin Cilic crushed Kazakhstan's Mikhail Kukushkin 6-1, 6-1, 6-1 in Varazdin to seal their tie 3-1.
Croatia will meet the United States in the semis in September. The US sealed their place in the last-four on Saturday after victory in the doubles gave them an unbeatable 3-0 lead over Belgium in Nashville.