That matched his own record, set back back in 2006.
While top seed Federer was only at his scintillating best in the first set nothing could be taken away from Anderson, who will become the first male player representing South Africa to contest a Wimbledon semi-final since Kevin Curren in 1983. In a fascinating final set, it took 24 games for the two to be parted; the South African claiming a 13-11 win after a match that lasted 4 hours and 13 minutes in total.
Only once before had Federer played more games at a Grand Slam and on that occasion, he prevailed 16-14 in the 2009 Wimbledon final against Andy Roddick.
Federer served first in the seesaw battle of extra time, which ought to have put Anderson at a slight psychological disadvantage, forced to serve from behind just to stay even.
"By the end I thought I did a great job not thinking about what was happening". After fighting back from match point and love-40 on his serve to take the third set, the South African broke Federer in the seventh game of the fourth set.
Federer had been pursuing a 13th Wimbledon semi-final and a 44th appearance in the last four of a grand slam.
Anderson had failed to take a single set off Federer in their previous four meetings. "I learned some valuable lessons throughout that tournament because coming in today, I think the way I approached the match was a bit more with expectations that I want to keep going", Anderson said.
He said: 'I felt like in the last month and a half, the level of tennis has been very close to where I would like it to be, where I'm used to having it. Reaching his first grand slam final at the US Open previous 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.
"Facing off that match point, then getting a break the next minute, I'm like, I've got the third set in the bag".
"That's how important Wimbledon is to me and to us over here".
In the semifinals, Anderson will face the victor of the matchup between American John Isner, the No. 9 seed, and Canada's Milos Raonic, the No. 13 seed.
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. "I really do. I think with the performances I've had, I deserve to be in the semi-finals", Djokovic, whose last major title came at the 2016 French Open, said.
After two years of physical and mental struggles, Djokovic appears fit and confident and ready to try to add to his tally of 12 grand slam titles. That compared with an average of 78 percent in the third and fourth sets, providing the spine that propped up his comeback on Court 1. As the match went on, I gave it my all.