Rafael Nadal fought back from two sets to one down to defeat Juan Martin del Potro in a superb match and set up a blockbuster Wimbledon semi-final against Novak Djokovic.
When Del Potro sent a forehand rifling down the line to take the third set, it seemed Nadal might be following Roger Federer out of the tournament, but the world number one recovered superbly to triumph 7-5 6-7 (7/9) 4-6 6-4 6-4 and keep alive his hopes of an 18th grand slam title.
Nadal should have led by two sets to love but was forced to come from behind before withstanding a supreme effort from his opponent in the fifth to clinch victory after four hours and 47 minutes.
"It was a very emotional match, a great quality of tennis, especially in the last set," he said. "Sorry for Juan Martin, he's an amazing opponent. In some ways he deserved the victory, too.
"Today was for me. Last year I lost a match (against Gilles Muller) 15-13 in the fifth. It's very important for me to be back in the semi-finals. It's a great thing."
John Isner reached his first grand slam semi-final by beating Milos Raonic in a battle of Wimbledon's biggest servers.
The American was beaten on the ace count by his Canadian opponent, who was runner-up to Andy Murray on the grass two years ago.
But he prevailed where it mattered on the scoreboard, winning 6-7 (5/7) 7-6 (9/7) 6-4 6-3 to set up a semi-final against Anderson.
Roger Federer earlier crashed out of Wimbledon after a marathon five-set shoot-out with big-serving Kevin Anderson in the quarter-finals.
The eight-time champion was two sets up and had a match point in the third, but almost three hours later he trudged off on the end of a seismic 2-6 6-7 (5/7) 7-5 6-4 13-11 upset.
Federer found himself scheduled on Court One having been ousted from his usual Centre Court domain for the first time in three years.
But he found himself in even more unfamiliar territory with an inspired Anderson's relentless, thudding serve eventually overpowering the 20-time grand slam winner.
The setting was not the only thing alien to the defending champion.
When Anderson broke in the second set it was the first time the Swiss had dropped serve at this Wimbledon.
In their four previous meetings Anderson, 32, had not taken a set off Federer. Nor had anyone over the last 34 sets Federer had played at the All England Club, until Anderson nicked the third.
That meant Federer had equalled but not bettered his previous best set-winning streak which came between the third round in 2005 and the final in 2006. But that turned out to be the least of his worries.
There was little sign of the drama which unfolded when Federer raced through the first set in 26 minutes.
Yet Anderson, the eighth seed, was meant to pose a far greater threat to Federer than his previous four opponents, and so it proved.
The first hiccup surfaced at the start of the second set with Anderson breaking the Federer serve and ending that run of holds.
Normal service was resumed for a while at least as Federer held to love before immediately breaking back and taking the ensuing tie-break.
Anderson was sticking to his guns, though, and after saving match point the eighth seed secured another break of the Federer serve and snatched a set back.
When Anderson broke again in the fourth, Federer was suddenly on the ropes.
The Swiss lost the set in a flurry of aces, with Anderson's relentless, powerful serve sending the match into a decider.
The final set lasted 90 minutes, and it was captivating stuff. Federer eked out a break point at 4-3, Anderson quickly snuffed it out, then Anderson served to stay in the match, and did so to love.
On they went, both holding to love for 10-10, but at 11-11 it was Federer who blinked first, a double fault handing Anderson a rare break point which he converted.
Anderson needed four more booming serves to reach a first Wimbledon semi-final, and he found them.
Federer had been pursuing a 13th Wimbledon semi-final and a 44th appearance in the last four of a grand slam.
"I'm not quite sure what to say, I had to try my best to keep fighting," Anderson told the BBC.
"I scraped through the third and fourth sets and by the end I thought I did a great job. Beating Roger Federer will be one to remember, certainly in such a close match.
"I just kept telling myself to keep believing, and that today it would be my day. That's the mindset you need against someone like Roger. I just gave it my all and I'm ecstatic to get through that."
Meanwhile Novak Djokovic ended his near two-year absence from grand slam semi-finals by booking a place in the last four at Wimbledon.
The Serbian beat Kei Nishikori 6-3 3-6 6-2 6-2 to reach his first semi-final at any of the four tennis majors since the US Open in 2016.
After a slump following two years of almost total domination of the men's game, Djokovic's star appears to be back on the rise and he is a clear contender to win a fourth Wimbledon title.
Djokovic, seeded 12th, incurred a warning for throwing his racket and was clearly frustrated, complaining of "double standards" when Nishikori was not punished for a racket throw.
He said: "I just asked the chair umpire how did I deserve that warning? I just asked him whether he thought honestly that I damaged the court with the racket.
"He said he thinks it damaged the court. Nishikori did the same in the fourth set and he didn't get a warning. I think that's not fair.
"He claims that he didn't see what Nishikori has done, but apparently he always sees what I do."
Djokovic had been yearning for a Centre Court date, after playing as many games on Court Two as the main show court beforehand in this tournament.
"That was very important," he added. "I played only once in first four matches on Centre Court. I'm pleased I'll be staying there right now."