Defending champion Novak Djokovic was made to battle before beating Gael Monfils 6-7, 6-2, 6-4 in the quarter-finals of the Shangai Masters.
The world number two cut a frustrated figure as he lost the opening set to the Frenchman on a tie-break (7-4).
But Monfils, who had upset Roger Federer in the previous round, found the going much tougher in the second.
A running debate with the umpire after a time violation seemed to affect his concentration and he also had to call for the trainer to get treatment for a hip problem.
Djokovic took advantage to take the set 6-2 but Monfils again tested the Serb in the decider as the first six games were shared.
Finally, Djokovic created some daylight when he broke in the seventh - letting out a huge roar in relief - and he held his next two service games to close out victory in two hours and 22 minutes.
"That was a very physical match and I knew that coming into this quarter-final with Gael winning against Roger he's feeling confident," said Djokovic.
"This is one of the fastest courts on the tour that we have so it's quite suitable to his style of the game and he runs all over the place. I didn't get many free points and I needed to work hard.
"I'm just glad I managed to play well when I needed to."
Djokovic also revealed that he was confident he could wear Monfils down.
"He's one of the best movers we have on tour but he's not physically very fit so I knew after dropping the first set that he wouldn't be able to hold that level so I just had to hang in there and stay tough and wait for my chances."
Second seed Rafael Nadal saw off Switzerland's Stanislas Wawrinka 7-6 (12/10) 6-1 to book his place in the last four.
The opening set was fiercely contested, Spaniard Nadal eventually coming out on top in a 20-minute tie-break before easing through the second set.
Nadal, winner of 10 titles this year including the French and US Opens, has now won all 11 meetings between the pair without dropping a set.
"The match in general, first set especially, was a very, very hard one," said Nadal, who saved three set points in the opener.
"I think I played a great set. But the court is fast. His serve was huge.
"He came to the court with that determination to hit every ball by taking the ball earlier, hit the ball very quick, go for the big shots in every moment. So was very difficult to stop him.
"The positive thing is when he was playing well, I was playing well, too. I was able to resist."
ATP Finals boost
Earlier, Juan Martin del Potro and Jo-Wilfried Tsonga boosted their ATP Finals hopes with quarter-final wins.
Del Potro can secure his spot in the year-end championship by reaching the final and he stayed on course for that with a 6-3, 6-3 win over Spain's Nicolas Almagro.
Del Potro hit 27 winners and only eight unforced errors as he went through in straight sets to secure a semi-final clash with world number one Nadal.
Frenchman Tsonga dropped just five games in beating Germany's Florian Mayer 6-2, 6-3 and will now play Djokovic in the last four.
Tsonga is playing catch-up after missing several months with a knee injury but victory over Mayer moved into the eighth and final qualifying spot for the ATP Finals.
French compatriot Richard Gasquet has now dropped to ninth.