The Swiss maestro found himself with his back to the wall after an error-strewn loss to Kei Nishikori in his opening round-robin match -- his first straight sets defeat in 46 group stage matches at the season-ending showpiece.
Another loss would have made it impossible for him to reach the semi-finals for the 15th time in 16 appearances at the tournament.
Yet 48 hours later, the 37-year-old Federer looked much more like his old smooth self as he rebounded in style, to the delight of the majority in the packed stadium.
Tournament debutant Anderson leads the group with two wins after thrashing Japan's Nishikori 6-0 6-1 earlier and would have been assured of a semi-final spot had Federer been beaten by Thiem or even dropped a set.
As it stands Federer will likely have to avenge his Wimbledon loss this year by Anderson to reach the semi-finals although all four players in the group could still mathematically progress.
Kevin Anderson is on the verge of qualifying for the semifinals of the ATP World Tour Finals after thrashing Kei Nishikori in London on Tuesday.
No.4 seed Anderson won 6-0, 6-1 in just 64 minutes to secure his second win of the week, following his opening victory over Dominic Thiem on Monday.