LONDON — Roger Federer is peaking at the right time — again.

The six-time champion advanced to the last four of the ATP Finals for a record-extending 15th time with a 6-4, 6-3 victory over Kevin Anderson on Thursday.

Federer, chasing the 100th title of his career, needed only a set to advance and produced his best performance at the season-ending tournament to end the round-robin stages with a 2-1 win-loss record.

"I've always tried to pace myself in a way ... that I would have something left in the tank," Federer said. "I'm happy that this is another week like this. (It) didn't look like it maybe 72 hours ago."

Dominic Thiem's 6-1, 6-4 victory over Kei Nishikori earlier had left Federer with a modest task and ensured that Anderson became the first South African ever to reach the semifinals.

Federer looked as if he was about to give up a break advantage for the second time in as many service games when he dropped to 0-40 attempting to close out the opening set at 5-4, but the 20-time Grand Slam champion found his first serve when it mattered most to hold.

Anderson hadn't faced a break point in winning his first two matches. Federer, though, broke him twice more in the second set to claim top spot in the group and likely avoid a semifinal meeting with top-ranked Novak Djokovic.

"That was a little bit disappointing because I felt like I played some really good tennis so far," Anderson said. "But the plus side is I'm through to the semis. That feels great."

Having struggled in an opening loss to Nishikori and relied mainly on his serve when defeating Thiem, Federer finally found some timing with his ground-strokes to apply consistent pressure on Anderson's serve.

The previously impenetrable Anderson serve wilted, with two double faults gifting Federer a 4-3 lead. Much to the surprise — and disappointment — of the partisan crowd at the O2 Arena, the Swiss great handed the break straight back with a series of errors.

However, Federer steadied himself and made a delicate drop volley to break once more in the following game, before eventually closing out the set to maintain his record of having only missed the semifinals once in 16 appearances at the tournament.

Federer lost just four points on serve in the second set. He used a backhand slice to break for 4-3 and the same shot brought up two match points at 3-5, 15-40.

"I think I had an aggressive-playing mindset," Federer said. "A good variation as well with my slice."

Having saved a match point on his way to securing a five-set quarterfinal victory over Federer at Wimbledon, Anderson threatened another comeback as he won a 21-shot rally to get back to deuce, but there was to be no repeat this time.

Two more Anderson forehand errors ended the match and Federer won the group by virtue of their head-to-head record.

With Djokovic clear favourite to top his group, which concludes Friday, Federer has boosted his chances of avoiding the in-form Serb until the final.

___

More AP Tennis: https://www.apnews.com/apf-Tennis and https://twitter.com/AP_Sports