World No.1 Novak Djokovic produced a rousing recovery to defeat Andy Murray to all but secure passage to the ATP World Tour Finals last four after a marathon match at the O2 Arena in London.

The US Open champion Murray, who had defeated Djokovic at Flushing Meadows in September, took the opening set 6-4.

But Djokovic stormed back to level the match, taking the second set 6-3, and appeared on the brink of victory as he secured an early break at the start of the deciding third set.

Murray staged a comeback of his own, breaking back to level the match at 4-4, but Djokovic remained calm, a match of 84 errors, again breaking the home crowd favourite's serve before closing out the match 7-5 in the third.

While Djokovic will qualify for the semi-final should Jo-Wilfried Tsonga beat Tomas Berdych, Murray will have to wait until his own meeting with the Frenchman to know his fate in a tournament he has never progressed beyond the knock-out phase.

Djokovic recovered from a break down to beat Murray in three sets.

Having defeated Tsonga in straight sets on day one, Djokovic knew a similarly dominant performance would confirm his place in the last four but he faced a player in Murray, who with the home crowd behind him, was seeking revenge for his defeat in the Shanghai Masters final.

If the current rivalry between the pair, which stood at 9-7 to the Serbian, was set to be the next big confrontation in the history of men's tennis, then the nature of the start suggested the pair were more than capable of confirming that status.

Murray found joy by virtue of a break-point chance in the very first game, and he duly converted as Djokovic netted a forehand return.

The 2008 champion was unable to find a foothold and his plight was summed up when it took him until the sixth game to claim his first point on the Murray serve.

The British No.1 should have secured a double-break and the set in the ninth game when he bamboozled Djokovic with a teasing drop shot, only for his forehand on set-point to fly wide.

The 2012 Australia Open champion couldn't take advantage of his reprieve as Murray took the opening set 6-4; seemingly laying the foundations for a comfortable afternoon's work.

But Djokovic had other ideas and following a first set in which he had been unable to create any break-point opportunities, he opened up by first saving a crucial break-point after his forehand volley clipped the baseline and then taking the lead in the sixth game, as Murray was forced to play a backhand return off his feet, and then missed a mid-court volley at the net.

Rapidly, Murray's performance turned from flawless to error-strewn, with 11 unforced errors coming in the second set while Djokovic began to get a handle on his serve and comfortably levelled the match, taking the set 6-3 to set-up a decider.

Signs Murray's service game had become disrupted were early in coming in the third, as Djokovic created three break-points in the third game, taking the second break chance and then holding his serve for a 3-1 lead.

At 0-30 down in the fourth, Murray's game appeared to be unravelling, and again as he fought his way back into the contest, he presented Djokovic with a break-point opportunity, which the five-time major champion wasted with a long forehand.

As Djokovic continue to hang on to his own serve, and the game ticked over the two-hour mark, Murray appeared to be on the brink. A thrilling rally, with the match at 4-2, saw Djokovic slip while sliding for a slice-forehand, but still recovered to eventually set up a break-point chance.

The Brit showed further resilience which paid off with a big second serve, forcing Djokovic into the net and then a series of punishing forehands from Murray eventually saw him escape.

The match had quickly become a war of attrition, but it was Murray who won the battle of the eighth game, setting up two break points as he began to edge the baseline exchanges, and forcing Djokovic into the tramlines to level the match.

A cautious hold followed; again as Djokovic blinked first in the baseline rallies, but under pressure when serving to stay in the match, he recovered from 15-30 to level at 5-5.

And he was rewarded for his grit with a break in the very next game, as Murray played a long forehand giving Djokovic the chance to serve out the match, an opportunity he took to put himself on the verge of the semi-final.