Eighth-seed Anderson, 32, saved a match point in the 10th game of the third set and grew in confidence against an increasingly-ragged Federer who had won the first set in 26 minutes. The South African's nerve held and so did his serve in the 24th game of the deciding set.
At 6 ft 8', one of the tallest players on the tour, Anderson produced an upset result of tall order, edging the top-seed in a titanic tussle.
How rare was it that Federer would lose after holding a match point in a major? In the end I did a great job, I wasn't thinking too much.
And his great rival Federer, despite the fact he will be 37 when the next Wimbledon comes around, allayed any fears that he might hang up his racket sooner rather than later.
"I just kept telling myself to keep believing, and that today it would be my day". You have to have that mindset. I gave it my all. After that I never really felt exactly 100 %.
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.
"Down two sets to love I tried my best to keep fighting".
After racing through the first set, Djokovic was handed his first code violation for unsportsmanlike conduct after bouncing his racquet into the grass in frustration at squandering three break points in the third game of the second set.
The 6-foot-8 Anderson, who won an NCAA doubles title at IL in 2006, is from South Africa.
Kevin Anderson, who played at the University of IL, knocked defending champion Roger Federer out of Wimbledon Wednesday. He stepped it up in the 12th game, nudging ahead to 0-30 but Anderson pulled back to level 6-all.
The decider went on serve deep into double figures, before Anderson broke in the decisive 23rd game to set up a chance to serve the match - a chance he duly took. Some of that was because the South African continued to attack at every opportunity.
The three-time champion spoke to Serbian media after his straight sets victory over Khachanov and revealed he has put in a request to play on Centre Court, having played there only once in this year's tournament.
"Roger is playing extremely well, moving well". The 31-year-old, however, served up the whole range from antics to awesome shot-making.
"I think the first warning was unnecessary", said Djokovic, who was sanctioned in the second set for spearing his racquet into the court. Reaching his first grand slam final at the US Open past year, where he lost to Nadal, gave him great confidence and it was noticeable even early on that he was able to push Federer back, a rare sight, especially on grass. But I also have a feeling, it was a feeling of mine, you know, not getting it right. It's my mission to get back to where I was.