Rafael Nadal won a Masters Cup round-robin shootout with Russian Nikolay Davydenko 5-7, 6-4, 6-4 on Friday to set up a semi-final against world number one Roger Federer.
The world number two had to take an injury time-out in the deciding set before outlasting Davydenko in a fascinating duel punctuated by long rallies and fine winners.
"This is one of my best wins of the year," the Spaniard told reporters after his Gold Group win.
"Tomorrow's going to be a very difficult match. Roger is playing at his best level, he's giving the best performances of his life."
American James Blake, who lost 6-2, 3-6, 7-5 to Spain's Tommy Robredo, had already won the group and will meet holder David Nalbandian of Argentina in the other semi-final.
Debutant Nadal, who pulled out of last year's event through injury, finished second in the group after losing to Blake in his opening match.
Nadal, who had never played Davydenko before, struggled with his serve throughout and allowed the Russian to apply early pressure.
"He is the number three in the world and he's playing at an unbelievable level," Nadal said. "He is very fast, hits the ball very cleanly and puts a lot of balls on the lines."
The French Open champion made up for his poor serve in other areas. He hustled his way to three break points in game seven but Davydenko cranked up his serve to save them all.
SUBLIME BACKHAND
When it looked like it would need a tiebreak to separate them, Davydenko pulled off a sublime backhand crosscourt winner to earn a set point before Nadal double-faulted.
Nadal broke serve in the first game of the second set and then survived a five-deuce fourth game.
"He's young now," said Davydenko. "He runs well, fights well.
"He is also a lefty. His second serve topspin makes it tough to return. I could not push him in the second set."
The 20-year-old Spaniard needed treatment below his left knee in the third game of the final set before rallying to take a 4-3 lead.
"My injury is not important. I was running a lot," Nadal said. "Davydenko was playing very, very hard.
"In the third set I asked for the physio and he put some hot cream on it. That's it."
Davydenko also tired in his 32nd tournament of the year and, despite claiming a break point when Nadal served for the match, eventually slipped to defeat when he went wide with a forehand.
"In the beginning I felt great, good concentration, I played fast, moved fast," the Russian said.
"Then we had some long rallies...and I was feeling a little bit tired and made some mistakes."