Spain's Rafael Nadal booked a Masters Cup semi-final clash against Roger Federer after beating Nikolay Davydenko 5-7 6-4 6-4 in Shanghai.
Nadal's victory completes the Masters Cup semi-final line-up
Nadal has been struggling recently and looked on his way out after dropping the first set with a double fault.
But an early break helped him take the second set and, after having his knee taped by the trainer in the decider, Nadal got the decisive break at 3-3.
Tommy Robredo beat James Blake 6-2 3-6 7-5 in the final round-robin match.
Blake had already won the Gold Group and will meet David Nalbandian in the other semi-final.
Nadal hailed his victory over Davydenko as one of his "best wins of the year" but he admitted Federer will provide an even tougher opponent on Saturday.
I think Federer can win the Masters. I don't think Nadal will win
"For me he's playing at his best level in the second half of the year," said Nadal.
"He's playing unbelievable, he's a special player and it's going to be very difficult to win against him.
"But I will try like always. I will give 100% and we'll see because other times I've played him he's been the favourite too."
Davydenko was the form man going into his match but could not maintain his punishing rhythm from the baseline at the end of a long season.
"At the start of the third set I was moving well, I was hitting balls well and I was feeling great," he said.
"But then there were some long rallies because Nadal tried to play baseline and top-spin and he was running a lot.
"Slowly I started feeling tired and then I started making some mistakes."
The Russian added: "I think Federer can win the Masters. I don't think Nadal will win."