Federer was on the ropes after dropping a comfortable two-set lead, and he even failed to take a match point chance in the third set, but the South African held his nerve to win a captivating contest 2-6 6-7 (5-7) 7-5 6-4 13-11.
US Open finalist Anderson, who became the first South African man to reach the semi-finals at Wimbledon since Kevin Curren in 1983, said: “Down two sets to love I tried my best to keep fighting. Beating Roger Federer here at Wimbledon will be one I remember, especially in such a close match.
“I kept telling myself to keep believing. I said today is going to be my day. You need that mindset against Roger.
“I’m ecstatic. That’s what you work so hard for. Matches likes that are very special.”