SHANGHAI: World number one Novak Djokovic laboured to a 6-3, 4-6, 6-4 victory over plucky Kazakh Mikhail Kukushkin to reach the Shanghai Masters quarter-finals on Thursday, while David Ferrer fought back from a set down to knock out Andy Murray.

Spaniard Ferrer will replace Murray in ninth spot in the race for the season-ending ATP World Tour Finals in London. There are five berths still up for grabs in the eight-man tournament.

Djokovic, who has already locked up his spot in London, probably did not expect the kind of resistance he faced from Kukushkin, who matched the Serb shot for shot for most of the match before being overpowered in the third set.

Djokovic broke Kukushkin for a 5-3 lead before closing out the first set but the Kazakh roared back into contention to stretch the contest to a decider.

Djokovic broke his opponent in the fifth game of the third set and went on to seal a quarter-final clash with Ferrer, who beat Murray 2-6, 6-1, 6-2 earlier on Thursday.

Murray, ranked 11th, had little trouble in the first set and looked poised for a quarter-finals berth, but Ferrer staged a brilliant comeback, breaking the Briton twice to take the second and level the match.

There was no let up in the final set either as the Spaniard raced to a 5-2 lead and raised his arms in celebration when twice champion Murray buried a return into the net.

“I needed to play my best tennis today,” Ferrer told the ATP World Tour website (www.atpworldtour.com). “I think this match was very important for both players. Today was a good victory.” Murray, who joined world number two Rafa Nadal, Australian Open champion Stan Wawrinka and US Open finalist Kei Nishikori in exiting the tournament before the quarter-final stage, was generous in his praise for Ferrer.

“He barely missed a ball for about a set and a half,” said Murray. “I couldn’t find a way around him. He played just great tennis, especially the last set and a half.

“(At) the beginning of the second set I still had a couple of opportunities there right at the beginning. But after that, I’ve got to give it to him, he played fantastically well and deserved to win.” Murray said he had not made up his mind yet about where he would compete next as he bids to qualify for the ATP Finals for the seventh successive year.

“We’ll see over the next few days where I decide to go. Hopefully I can play well the last couple of tournaments, try and make a push for London,” he added.

Czech Tomas Berdych boosted his hopes of securing one of the five remaining places in London with a 6-3, 6-4 victory over Ivo Karlovic, who hit 19 aces in the third-round clash.

Berdych will replace US Open champion Marin Cilic, beaten by Karlovic in the opening round in Shanghai, in sixth place in the race to London if he beats Gilles Simon in the quarter-finals on Friday.

Frenchman Simon overcame Malek Jaziri of Tunisia 6-2, 6-3 while Julien Benneteau beat American Jack Sock 6-3, 6-4.