Roger Federer showed flashes of his best but Novak Djokovic exposed the Swiss maestro's fading powers with a three-set victory at the ATP World Tour Finals on Tuesday.

World number two Djokovic, at 26 six years Federer's junior, briefly looked in trouble midway through an absorbing Group B opener but eventually surged to a 6-4 6-7(2) 6-2 win in front of another sell-out crowd at the O2 Arena.

Djokovic's win, his 18th in a row since losing to Rafa Nadal in the U.S. Open final, was his second in four days over Federer and kept alive his slender hopes of toppling the Spaniard from the top of the world rankings.

In the day's Group A match, Nadal crushed compatriot David Ferrer 6-3 6-2 and will seal the year-end No. 1 ranking for the third time in his stellar career if he beats Swiss Stanislas Wawrinka on Wednesday.

Three days after losing to Ferrer in the Paris Masters semi-finals, Nadal resumed his customary dominance over his compatriot with a victory that will not live long in the memory.

"I played with a little bit more calm than the other day," Nadal, who is trying to win the only major prize to elude him, told reporters after his first match at the venue since 2011 after he missed last year through injury.

"Last year was a big miss for me. Even if I was not able to play my best a lot of times here, I really have great feelings every time I have the chance to play in this stadium."

Nadal was gifted half the points he won in unforced errors by the unusually profligate Ferrer, who admitted it had been a "bad day".

Djokovic, on the other hand, was made to work hard against old adversary Federer.

With the pre-match music blasting around the steep stands and the players emerging on to a darkened court accompanied by smoke and lights the stage seemed set for some fireworks on the day Britain marks Guy Fawkes night.

However, the 31st clash between the two never quite reached a crescendo as Federer showed he is struggling to maintain the intensity needed to get the better of the top guns in world tennis.

'TOUGHEST START'

With the majority of the 17,000 crowd, many dressed in Swiss red and wearing Federer-branded clothing, roaring on the 32-year-old he battled back from the disappointment of dropping serve in the 10th game to lose the first, levelling the match with a sublime tiebreak which he won 7-2.

After spluttering into life, however, Federer lost his spark in the deciding set as Djokovic repeated his victory over the Swiss in Paris at the weekend.

"It's slow here and it's the first match, so there's going to be errors," Federer, who had not lost his opening match at the Tour Finals since 2008, told reporters.

"There's a lot of neutralizing going on. You have to take a lot of chances to get the ball past Novak, like I mentioned. Eventually that draws errors out of you."

Defending champion Djokovic, who was in action in Paris until Sunday and had precious little time to adapt to the conditions in London, looked weary at the end of the second set but struck back immediately at the start of the decider.

Federer's resistance melted away after he had been broken to love in the first game of the decider and there was no way back when he surrendered serve again to trail 4-1.

Federer, who has won a record six titles at the year-ender, remained hopeful of beating Richard Gasquet on Thursday to keep alive his hopes of ending a disappointing year on a high.

Djokovic will face Juan Martin del Potro on Thursday and said he was relieved to survive a tough opener.

"It was probably the toughest start I could get for this tournament, especially considering the scheduling that I had, playing two days ago in Paris finals," he said.

"I didn't know how I would respond physically. It took some adjustment, but I'm happy with the way I played. I'm just happy that I overcome this challenge."