Top seed Rafael Nadal was given a scare before being handed a place in the semi-finals of the Shanghai Masters.
Ivan Ljubicic took the first set of their quarter-final before the Spaniard advanced when his opponent had to withdraw because of a thigh injury with the score at 3-6 6-3.
A single break, courtesy of a Nadal forehand error, was enough for Ljubicic to claim the first set.
Ljubicic was on fire and maintained the upper hand even as Nadal improved towards the end of the set.
The Croat had the chance to break at 1-1 in the second, but Nadal battled to save four break points and took advantage by breaking Ljubicic to love in the next game.
Nadal held his nerve to claim the set, but by then Ljubicic's discomfort had become obvious and he was unable to serve at the start of the third.
Second seed Novak Djokovic also had an uncomfortable day, needing three sets to seal a 6-3 2-6 6-2 win over Gilles Simon - a match which turned on a topsy-turvy start to the third set.
The Serbian needed two breaks to overcome stubborn Simon, who kept biting back at him, in the first set.
And the Frenchman's dogged defence saw a frustrated Djokovic go to pieces in the second as he produced a host of enforced errors.
In the third, Djokovic was a model of inconsistency. He threw in some misjudged drop shots and double faults - and he screamed at himself as he threw away his early advantage, having broken in the very first game.
He broke again immediately, then saluted the crowd as some exquisite shots found the lines at 15-30 in the next game, but he put a routine overhead into the net to allow Simon to break back before mangling his racket on the ground in annoyance.
Again Djokovic broke with the help of a trademark drive volley and this time he was able to make his advantage stick, holding for the first time in the set before going on to claim victory.
'In the second set I made a lot of unforced errors,' he told Sky Sports 1. 'He was a tough opponent - he's one of the trickiest players on the tour.
'I was very aggressive in the third set and I think it paid off.'
Next up for Djokovic is Russian sixth seed Nikolay Davydenko, who beat Radek Stepanek of the Czech Republic 6-1 4-6 6-1.
Spain's Feliciano Lopez, who beat Robin Soderling of Sweden 7-6 (7/4) 6-3 to reach his first semi-final of the year, awaits Nadal.