The big South African's hopes looked dim as Federer skipped through the opening two sets on Court One with his usual panache, but he turned the match on its head to cause the biggest shock in a tournament full of upsets. The eight-time champion and 20-time grand slam victor last played a Wimbledon match outside Centre Court in 2015.
But, playing on Court One for the first time in 3 years, Federer was unusually error-prone and became visibly frustrated as 8th seed Anderson refused to surrender.
Three-time Wimbledon champion Novak Djokovic got his wish to play in the main stadium, and he reached his first Grand Slam semi-final since 2016 by beating number 24 seed Kei Nishikori of Japan 6-3, 3-6, 6-2, 6-2.
Anderson staved off Federer's first and only attempt at match point, trailing 5-4 in the third set, before winning the game to tie the set at 5-5 and ultimately winning the next game to take a 6-5 lead.
"I think psychologically there's a huge difference for Anderson to play on Court One rather than Centre", the Swede, working as Eurosport's chief analyst, told Reuters.
Wimbledon wont budge on World Cup final clash, happy with phone viewing
Four thousand spectators fled in search of pubs, while others huddled around screens within the grounds. England could play the final as they have reached the semi-finals.
In the end, he threw up his hands when a Federer shot flew long. I felt I was really in the flow of the match.
"I have worked very hard to try and get myself in the best possible shape for the biggest event and this is certainly one of the best".
Up a set and serving for the second, Federer got angry at a call that was reversed by the Hawk-Eye system.
The Swiss refused to blame his surprise defeat on the decision to play the match on court one rather than his customary Centre Court stage at the All England Club. "The more I can just treat it like another tennis match, the better for me", Anderson said earlier in the week.
Kevin Anderson, left, rallied from two sets down to deny Roger Federer's bid to win his ninth Wimbledon title this year.
"I felt I was really in the flow of the match". It rattled Federer, who blew the next match point and then double faulted on break point.
Roger Federer out of Wimbledon 2018 after Kevin Anderson defeat
Anderson scented blood and, out-duelling Federer time and again, he broke in the seventh game to level the match at two sets all. Raonic never broke Isner's serve, and while Isner broke Raonic's serve just three times, it was just enough to move on.
Two-time Wimbledon champion Nadal, who is chasing an 18th Grand Slam title, won the pair's most recent clash in the semi-finals of the French Open last month.
"I think the first warning was unnecessary", said Djokovic, who was sanctioned in the second set for spearing his racquet into the court.
That took great self-belief, he added, knowing that he had never taken a set off 20-time major victor Federer in four previous meetings. "As of right now, I'm sort of more focused on that than getting too excited about the overall picture".
Federer responded, quickly breaking back before taking the set in a tie-break. "I had my chances".
But he has been fairly solid at the Slams ever since, making at least the last-16 at all the majors - with the exception of a first round blip at the Australian Open this year.
Croatia rally to oust England in extra time: How social media reacted
England too left Italy 28 years ago feeling that the team featuring Gary Lineker and Paul Gascoigne could have gone all the way. Their four-nation group was so weak that Southgate could afford to rest his starters after wins against Tunisia and Panama.