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.
None of the previous ones had been as tough as this as world number six Nishikori, the highest-ranked player Murray had ever faced in the competition, simply refused to lie down.
New father Murray had not played a match for a month prior to this tie and that seemed to catch up with him in the fourth set but he refused to be beaten in front of a raucous crowd.
After three fairly predictable results over the first two days - albeit with a good display in defeat from Dan Evans against Nishikori - this was the crux of the tie.
Both players have excellent records in the competition. Murray had only lost two of his 30 previous singles matches, and was unbeaten on hard courts, while Nishikori was 19 from 21 and had not lost since 2012.
Murray boasted a superior advantage in their head-to-head having won five of six meetings but he had lost their only previous clash indoors, at the O2 Arena in 2014.
Nishikori, with his quick hands and quick feet, is a major talent and one of the very best strikers of a ball in the world.
He showed the danger facing Murray in the opening point, putting together a series of crisp groundstrokes before finding the line with a forehand.
But over the first two sets it appeared a classic Murray Davis Cup performance, with the Scot dallying with danger but finding a way to come through.
Nishikori recovered from 4-1 to 4-4 in the opener only for two double faults in the final game to present Murray with a golden chance.
He still had to work extremely hard to take it, finally forcing Nishikori into a mistake at the end of a rally of superb quality.
Murray was the one to go down an early break in the second as his stress levels rose once again and, when he missed a break point to get back on level terms in the fourth game, he smashed his racquet so hard against his foot that it broke.
That earned him a warning from the umpire but he channelled his aggression in the right way on the next point with a sumptuous backhand winner.
He could not take two set points in the 12th game and then saw a 4-0 lead in the tie-break turn into a 5-4 deficit.
But he found a way , saving a set point with an ace and then taking his first chance when some trademark great defence paid off with a Nishikori error.
There was little indication that things were about to take a downward turn in the third set until a double fault gave Nishikori a break point at 3-4. He took it and then clinched the set with a beautifully-threaded backhand winner down the line.
The Scot was like a tightly-coiled spring as he desperately tried to get his country across the line but he could not take his chances, missing two break points early in the fourth.
That revitalised Nishikori, who had begun to look a little weary, and he sapped Murray's energy and spirit with a run of four straight games.
The two-time grand slam champion roused himself to retrieve one of the breaks but Nishikori served it out at the second attempt to force a decider.
Fatigue was taking over Murray's body and omens were not good when he dropped serve at the start of the fifth but the noise level reached fever pitch as he hit back with three games in a row.
Nishikori broke back but then Murray slammed a forehand winner down the line at the end of a game that felt tie-deciding.
The same could be said of the next as Murray withstood a barrage of pressure to hold and then created two match points at 5-2, both of which Nishikori saved.
But the Japanese resistance finally ended at the fourth time of asking, beaten into submission by the brilliance and sheer determination of Murray.
Murray said: "The crowd helped for sure. I was struggling a little at the end of the third and a little bit throughout the fourth.
"There were long rallies, he was pushing me quite far off the baseline. I was trying to keep the points short but in the fifth I had to grit my teeth, fight hard and I managed to get the win.
"I was a little bit calmer in the fifth set. I was panicking a little bit at the end of the third when I was struggling physically, I didn't quite know what to do.
"In the fifth I went back to what I was doing in the first set. Positive energy, fight for every single point and that was enough today.
"This team has done something special last year and I would like to do something similar this year if we can."
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."
Murray can now head home to Surrey to spend a bit more time with daughter Sophia before flying to Indian Wells for the first Masters event of the year.
The Scot said: "It's Kim's first Mother's Day. I'll try to get back for bath time and put her to sleep."