Federer and Anderson progressed from Group Lleyton Hewitt on a day when Kei Nishikori and Dominic Thiem were eliminated.
Nishikori couldn't replicate his heroics against Federer on Sunday as he slumped to a straight-set defeat against Thiem. The latter won the opening set emphatically and stayed in control when the Japanese attempted a comeback in the second.
It meant Nishikori was eliminated early, while Federer was still in with an excellent chance of ensuring progress. He did so by beating Anderson, who needed to beat the Swiss to keep Thiem in the tournament.
Thursday's Results, Group Lleyton Hewitt
(6) Dominic Thiem bt. (7) Kei Nishikori, 6-1, 6-4
(2) Roger Federer vs. (4) Kevin Anderson, 6-4, 6-3
Friday's Schedule, Group Guga Kuerten
Not before 2 p.m. GMT/9 a.m. ET: (3) Alexander Zverev vs. (8) John Isner
Not before 8 p.m. GMT/3 p.m. ET: (1) Novak Djokovic vs. (5) Marin Cilic
Federer had Thiem to thank for his reprieve after the Austrian systematically wore down Nishikori on the centre court. Thiem controlled serve by booming three aces and saving a quartet of break points.
While Nishikori couldn't break serve, Thiem managed to do so three times.
Despite his assured performance, Thiem was still left hoping Anderson would inflict damage on Federer. It didn't seem likely though, with the latter not needing to do too much to move on:
As for Nishikori, he started superbly by upsetting Federer, but it's been all downhill in group play since:
It was time for Federer to top the group after seeing off Anderson. The latter smashed 10 aces past his decorated opponent, but Federer still managed to break the South African's serve four times.
Wrapping up the first set at 6-4 put Federer in the last four yet again. Buoyed by the knowledge he was already through, Federer was clinical in the second set, making even shorter work of Anderson.
Federer had continued his dominance of this tournament:
In terms of what comes next, Federer has a chance to avoid top seed Novak Djokovic in the last four if results fall a certain way on Friday:
Federer hasn't hit top gear yet, but he would likely still welcome another chance to pit his wits against Djokovic and prove he still has enough left to beat the best when it matters.