Defending champion Novak Djokovic booked his place in the semi-finals of the ATP World Tour Finals with a 6-3, 3-6, 6-3 victory over Juan Martin del Potro on Thursday.

After Roger Federer defeated Richard Gasquet earlier in the day 6-4, 6-3 to keep his hopes of a last-four spot alive, Djokovic knew any win against the Argentine fourth seed would guarantee his qualification from Group B with one match still to play.

And the world number two seized his chance, surviving a tough test lasting nearly two hours to extend his current winning run to 19 matches.

Del Potro can still make the last four as well, but he will have to beat Federer on Saturday.

"With his serve it's definitely a big advantage if I can get a break and then close it out," Djokovic said.

"Thankfully I managed to do that. I'm very glad I could win this match and make it to the semi-finals."

"I just feel good at this particular part of the year. I know most of the players are exhausted physically, mentally, emotionally, after a long season.

"But I try to find that as an opportunity for me to get extra motivated to push myself to the limit and deliver the goods when needed."

Djokovic discovered on Wednesday that his bid to finish the season as world number one had failed after Rafael Nadal wrapped up top spot in the year-ending rankings.

But he showed no signs of letting that disappointment affect him as he continued his bid to retain the title at the prestigious season-ending event at London's O2 Arena.

Four months ago, on a sweltering July afternoon, Djokovic out-lasted del Potro in an epic encounter that took nearly five hours and finished as the longest semi-final ever played at Wimbledon.

This was their first meeting in London since then and Del Potro took the attack to Djokovic in the Serb's opening service game, securing two break points.

But, as was so often the case when they met at Wimbledon, Djokovic was able to get out of trouble with peerless ability to turn defence into attack in one motion.

Djokovic was unable to convert three break points in the fourth game, but simply came back even harder in del Potro's next service game and this time he did break to open up a 4-2 lead.

That was enough to effectively seal the first set and put the two-time Tour Finals champion within one set of a place in the last four.

Del Potro refused to accept his fate however and, hitting a rich vein of form, he pressed Djokovic into conceding two break points in the sixth game of the second set, converting the first thanks to a fortunate net-cord before going on to level the match.

But Djokovic had beaten the former US Open winner in 10 of their previous 13 meetings and it wasn't long before he was back on top.

The Australian Open champion had to stave off two break points early in the final set, but he gradually turned the tide and landed the decisive break for a 4-2 lead before serving out the win.

Federer's 81-minute win over Gasquet meant that he avoided the embarrassment of losing two straight group matches in a row for the first time at the year-end event after the six-time champion was beaten by Djokovic in his opener.

Federer still needed six match points to get the job done in an afternoon of 29 winners and 30 unforced errors as he broke Gasquet in a marathon final game.

The 17-time Grand Slam winner wasted his first five match points with unforced errors before Gasquet put a return wide.

"Today was just a battle for myself, making sure I move the right way, I play the right way, I have the right shot selection," said Federer.

"Richard does a good job of making you feel uncomfortable; he uses heights, spins really well. He likes extended rallies.

"But I guess those are the kind of matches I need right now -- straight sets against a good player. It clearly comes at the right time."

Federer, playing the season finale for the 12th consecutive year, earned his 11th win over the Frenchman from 13 matches.