Roger Federer got his ATP World Tour Finals campaign back on track with a straight-sets win over Richard Gasquet.
The Swiss star won 6-4 6-3 and will play Juan Martin Del Potro in his final Group B match on Friday, with a semi-final place still up for grabs.
Federer, who lost to Novak Djokovic on Tuesday, needed six match points to see off Gasquet in a tense finish.
Djokovic and Del Potro meet at 20:00 GMT, with a straight-sets win good enough for either to progress.
Federer, 32, is playing in the season finale for the 12th consecutive year and has only once failed to make it out of the group stage, but that danger loomed large after his defeat by Djokovic.
It remains a considerable task for the six-time champion to progress, with Del Potro likely to pose a sterner test than Gasquet.
"It is a big win for me and hopefully I can keep it up in the next match against Juan Martin," said Federer. "There is a lot to play for. There are a lot of calculations going on in a three-way race, so hopefully it won't be that close this time."
The errors that have crept into Federer's game in recent years remained against Gasquet, but he had the advantage in both power and athleticism.
1st serve %
1st serve win %
2nd serve win %
The Frenchman, 27, won the first six points but a couple of fizzing forehand winners got Federer out of trouble from 0-30 in game two, and a sweeping cross-court backhand helped him to break in game three.
All was going according to plan for the 17-time Grand Slam champion but an edgy service game at 4-3 allowed Gasquet back into the set, with Federer's backhand breaking down under pressure and flying wide.
The Swiss regrouped quickly, however, playing a fine return game to regain the initiative after Gasquet framed a forehand high into the O2 Arena stands on break point.
Federer was in control once again and began to produce the moments of brilliance that have marked his whole career, easing into a 2-0 lead in the second set with some sharp attacking play at the net.
It did not signal an acceleration to the finish line, however.
Federer had to fend off break points in the next three service games, and Gasquet had his man well and truly rocking with a rasping backhand down the line and a flashing forehand return in game eight.
It proved to be Gasquet's final flourish of the afternoon, as Federer caught him out with a lob on break point and eventually brought an edgy encounter to a close at the sixth time of asking.
Juan Martin Del Potro