Mannarino was already handed a point after Federer's shot landed outside the court, but the Swiss was seen going on his front-foot and defending the ball with the middle of his racquet and a flawless roll of the wrists.
He won the third set to snap Federer's 34-set winning streak at Wimbledon and the top-seeded Swiss was clearly shaken as Anderson dominated the fourth set to drag the 20-time Grand Slam champion into a decider.
But after squandering a match point in the 10th game of the third set Federer's game frayed at the edges and an inspired Anderson powered back to claim victory in four hours 14 minutes.
Three-time Wimbledon champion Novak Djokovic got his wish to play in the main stadium, and he reached his first Grand Slam semifinal since 2016 by beating No. 24 seed Kei Nishikori of Japan 6-3, 3-6, 6-2, 6-2.
That being said, this Kevin Anderson is a much-improved player since their last encounter at the 2015 Cincinnati Masters.
In the end, it just wasn't meant to be Roger Federer's year at Wimbledon. The 16-time Grand Slam champion also won their most recent meeting - French Open semi-final 6-4, 6-1, 6-2.
"I just don't know exactly how I couldn't create more opportunities once the third set came around", Federer said.
Anderson never had made it beyond the fourth round at Wimbledon until this week, carried by his booming serve.
Federer, meanwhile, had his serve broken four times - the first four times his serve was broken during this Wimbledon run. I think that's not fair.
"I don't think it really mattered, to be honest". That's my problem really, the 36-year-old said. I had my chances and blew them.
Federer had breezed into the quarter-finals and was imperious in the opening set.
Switzerland's Roger Federer grimaces after losing a point during the fifth set of his men's quarterfinals match against Kevin Anderson of South Africa at the Wimbledon Tennis Championships, in London, Wednesday July 11, 2018.
However, Federer has held all of his 55 service games this year and last dropped serve in the semi-finals in 2017 - 81 service games ago.
And, despite his two-set advantage, the 20-times grand slam victor never looked entirely comfortable, despite having never previously lost a set to Anderson in four other meetings. However, Djokovic is in some fine form, and his unbelievable movement on the grass coupled with his solid all-round game may well wear his opponent down on this occasion.