Roger Federer withstood a stunning fightback from Kei Nishikori to claw out a 7-5 4-6 6-4 victory and stay undefeated at this year's ATP World Tour Finals on Thursday.
The win means Swiss Federer tops Stan Smith Group, having won all three of his round-robin matches at the ATP's season-ender for the ninth time in 14 consecutive appearances.
It was touch and go, though, at the end as Federer let slip a 4-1 lead in the second set, losing five games in a row as Japan's Nishikori began to dominate from the baseline.
The Japanese looked the stronger player at the start of the deciding set but allowed Federer off the hook when he failed to break the Swiss's serve in the third game having been 0-40 up.
World number three Federer, urging himself on despite having already guaranteed himself a semi-final, moved 4-1 ahead in the decider, only for Nishikori to surge back to 4-4.
Federer found four first serves to give himself some respite and force world number eight Nishikori to serve to stay in the tournament. This time he wavered and Federer claimed victory with a powerful overhead and end Nishikori's progress in the tournament.
World number one Novak Djokovic will clinch runners-up spot in the group if beats Tomas Berdych later, although he would be eliminated if he lost to the Czech in straight sets.