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 victor.
Meanwhile, Novak Djokovic shrugged off a second-set slump to reach a Grand Slam semifinal for the first time since 2016 by beating Kei Nishikori 6-3, 3-6, 6-2, 6-2. The three have lost one set between them all tournament. But Anderson held his nerve to level up and then produced a remarkable surge in form to take Federer deep into the fifth set.
What does the loss mean for Roger Federer? But that turned out to be the least of his worries.
Ramos then hit Djokovic with a time violation warning for taking too long to serve in the seventh game of the fourth set.
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. More than two hours after that match point, Federer and Anderson battled and battled.
When Anderson broke again in the fourth, Federer was suddenly on the ropes.
The final set lasted 90 minutes, and it was captivating stuff. In his first four matches the Swiss had been utterly dominant on serve, winning 92 % of points on first serve, his best ever serving stats in his 20 years at Wimbledon.
It was a surprise result that now sends the eighth-seeded Anderson to the semifinals at Wimbledon, his first time making it that far in the storied competition that Federer has won eight times, including a year ago.
Djokovic is a 12-time major champion who's been in something of a rut, due to right elbow troubles that lasted more than a year until he finally had surgery in February.
Federer, 36, was on a quest for his ninth Wimbledon title and 21st Grand Slam trophy overall. "I was in the flow of the match", eighth seed Anderson said. "I don't think it's fair but it is what it is". So much more. Federer was attempting to reach his 13th semifinal at Wimbledon and move closer to title No. 9, both of which would have broken his own records.
"I just kept telling myself to keep believing, and that today it would be my day". You need to go with that mindset against a player like Roger.
The Ottawa native and partner Yifan Xu of China, the tournament's sixth seeds, defeated the unseeded pair of Bethaine Mattek-Sands of the USA, and Lucie Safarova of the Czech Republic 5-7, 6-4, 6-2 in a quarter-final on Wednesday.