Great Britain fought hard to keep alive the defence of their Davis Cup title, but could not quite pull off a comeback against Argentina in Glasgow.
Trailing 2-0 on Friday after singles defeats for Andy Murray and Kyle Edmund, the chances of Leon Smith's team reaching a second successive final looked slim indeed.
But the Murray brothers won the doubles on Saturday and Andy defied a leg injury to defeat Guido Pella 6-3 6-2 6-3 in the opening match on Sunday.
So the tie came down to a clash between Dan Evans and Leonardo Mayer, and it was the Argentinian who prevailed 4-6 6-3 6-2 6-4.
Evans would have expected to face Juan Martin del Potro, conqueror of Murray in five hours on Friday, but the former US Open champion hinted on Saturday he was not prepared to risk his fragile body.
Andy Murray beat Guido Pella despite an injury to send Great Britain's Davis Cup semi-final against Argentina to a deciding fifth rubber.
After more than eight hours of tennis already in this tie and on the back of a gruelling summer, it was amazing the world number two even had the energy to drag himself onto the court at Glasgow's Emirates Arena.
But, with the atmosphere having stepped up yet another notch, he did a lot more than that and raced to a 6-3 6-2 6-3 victory over an outclassed Pella.
On the face of it, it was straightforward, but Murray spent much of the third set wincing and needed an off-court injury time-out.
World number 49 Pella had been impressive in defeating Kyle Edmund on day one to give the visitors a 2-0 lead but Murray ruthlessly exploited his lack of weapons.
The victory, which took two hours and 11 minutes, meant Britain's hopes of a second successive Davis Cup final rested on the shoulders of Dan Evans.
Andy Murray is set to return to Great Britain's Davis Cup team for next weekend's semi-final against Argentina in Glasgow.
The world number two, who sat out the quarter-final in Serbia in July following his Wimbledon triumph, was named in a provisional five-man team alongside Kyle Edmund, Dan Evans, Jamie Murray and Dom Inglot.
Murray's participation could yet depend on how he fares at the US Open, where he eased through to the quarter-finals on Monday night with a thumping win over Grigor Dimitrov.
The Davis Cup tie begins at the Emirates Arena on September 16, only five days after the final in New York.
But, unlike the Serbia clash, Murray would not have to contend with a change of surface and, injury permitting, seems almost certain to play.
Great Britain's Davis Cup team have held a minute's silence for the victims of the Nice attack.
Leon Smith, Kyle Edmund, Dominic Inglot, James Ward and Jamie Murray stood to remember those who died ahead of their quarter final match with Serbia in Belgrade on Friday.
Andy Murray will spearhead holders Great Britain's bid to reach the Davis Cup semi-finals next week.
The Wimbledon title favourite has confirmed his availability for the last-eight tie against Serbia in Belgrade, which world number one Novak Djokovic has chosen to miss.
The Lawn Tennis Association named Murray in a squad that also contains Kyle Edmund, Jamie Murray, Dan Evans and Dominic Inglot, for the three-day tie beginning on Friday 15th July.
Great Britain's Davis Cup captain Leon Smith said: "In making himself available for the tie, Andy has once again shown incredible commitment to his country and his proven Davis Cup record is second to none."
Aljaz Bedene's hopes of playing Davis Cup tennis for Great Britain have been dashed once again after he lost his latest appeal.
The 26-year-old, who was granted a British passport last March, presented his case to the International Tennis Federation board on Sunday.
He said: "Of course I am very sad with today's result and that it has not gone the way I had hoped.
"I would like to thank all the fans, my team and the LTA (Lawn Tennis Association) for continuing to support me all the way. I will have to assess my situation now before I decide on what steps to take next."
Bedene has fallen foul of a rule brought in at the start of 2015 preventing players competing for more than one country in the competition.
Because he played in three dead rubbers for his native Slovenia between 2010 and 2012, he is ineligible to represent Britain.
Davis Cup-winning captain Leon Smith has extended his contract and will lead the Great Britain team for at least another three years.
The Scot succeeded John Lloyd in 2010 after Britain had suffered the ignominy of defeat by Lithuania and were on the verge of relegation to the competition's bottom tier.
Five years later Smith achieved what had appeared impossible and guided his country to a first Davis Cup title in 79 years with victory over Belgium.
After signing a deal until the end of 2018, which will also see him remain as the Lawn Tennis Association's head of men's tennis, Smith said: "It is a huge honour and privilege to continue captaining our Davis Cup team.
"We have achieved so much over the last six years and becoming world champions last year will be the highlight of my career."
Andy Murray produced his most remarkable Davis Cup effort yet to hold off an inspired Kei Nishikori and send Great Britain through to the quarter-finals for a third straight year.
Murray led by two sets to love but faced losing from that position for the first time in 11 years only to grind out a 7-5 7-6 (8/6) 3-6 4-6 6-3 victory after four hours and 54 minutes at Birmingham's Barclaycard Arena.
That clinched a 3-1 first-round win over Japan for Britain, with Murray winning all three points for the fourth successive tie.
Great Britain captain Leon Smith reserved the highest praise for his main man, saying: "I'm pretty much lost for words. He's just a man of steel.
"You have to give a lot of credit to Kei. He played a great match, one of the best of his life I'm sure.
"It's quite astonishing considering Andy hasn't played since the Australian Open final. He's amazing. It's an absolute privilege to sit with him for a match like that and we'll remember that one for a very long time."
Andy Murray's appetite for another stellar Davis Cup run should see him partner brother Jamie in Saturday's doubles as Great Britain look to restore their lead over Japan.
The teams were tied at 1-1 after the first day of play at Birmingham's Barclaycard Arena, with Murray easing past Taro Daniel 6-1 6-3 6-1 before Kei Nishikori withstood a fierce challenge from Dan Evans to win 6-3 7-5 7-6 (7/3).
Murray's match was his first since becoming a father nearly a month ago and he was wary of committing to doubles as well as singles beforehand, but captain Leon Smith confirmed the plan is for the brothers to team up as they did successfully on three occasions last year.
Andy Murray says his top priority is trying to be a good dad following the birth of his daughter Sophia Olivia.Read the full story ›