Dan Evans battled to a three-set victory over Germany's Jan-Lennard Struff to steer Great Britain into the Davis Cup semi-finals.
After Kyle Edmund handed Great Britain the lead with an impressive 6-3 7-5 win over Philipp Kohlschreiber, Evans was looking to send GB into the last four before the doubles rubber.
British No 1 Evans had lost both of his group matches despite taking the first set, and he showed incredible resolve on Friday evening to bounce back from dropping the second set once more to win the deciding tie-break.
The 7-6(6) 3-6 7-6(2) victory means GB will await the winners of Spain's clash with Argentina.
"It's great, listen I lost some tough matches lately and felt like I let the team down the past couple days," Evans said.
"To come back today and get it like that, it's amazing for them, they all support me through everything. I'm just so happy for them that we're through.
"I thought I was playing good the last two days but couldn't get over the line. It was tough, before the match I didn't feel great. You're down, you're losing, but everyone in the team has kept me going and keeping me positive."
Captain Leon Smith added: "I can't believe it. He's had a tough couple of days, we were talking about how to change things up today and free him up.
"He was feeling down, but boy did he step up today, and I'm absolutely thrilled for him. That reaction at the end I'll savour forever."
"Now we've got an amazing opportunity in the semi-finals, but we're going to enjoy this one.
"We feel great. Coming into this I knew we had a really good squad. People might have started doubting us but everyone has now posted wins which is a great feeling going into a semi-final."
A tight first set saw Evans break to lead 5-4, but he could not serve it out as Struff fought back before forcing a tie-break.
There were as many points dropped on serve as there were held in the breaker, but it was Evans who prevailed 8-6 after converting his second set point.
The two group defeats will have weighed heavily on Evans' mind in the second set, having lost both after taking the opener.
And there were fears a similar pattern was playing out when Struff broke twice to take the set 6-3 and send it to a decider.
However, after the third set remained on serve until the tie-break, Evans held his nerve to win three points on Struff's serve and storm clinch the breaker 7-3.
Kyle Edmund produced a dominant display to hand Great Britain the lead with a 6-3 7-5 win over Philipp Kohlschreiber in their Davis Cup quarter-final tie against Germany in Madrid.
The 24-year-old absolutely crushed his groundstrokes as he overpowered a player 12 years his senior to hand Leon Smith's side a very valuable lead in the last-eight encounter.
Edmund was hugely impressive from the outset, and he closed out the opening set in remarkable fashion as he held serve in just 78 seconds.
The first-set break had come at 3-2 as Edmund capitalised on a succession of sloppy serves from his German opponent.
Kohlschreiber significantly lifted his level and intensity in the second set and he broke Edmund's serve for the only time in the match at 2-1 up.
But the Brit bounced straight back before he seized the initiative again to break and clinch victory from 5-5 with the match in the balance.
Edmund was again seemingly nerveless as he closed out the win before he was mobbed by his team-mates and GB staff on the sideline.