Rafael Nadal leads the head-to-head with Roger Federer 23-14 but has not beaten the Swiss in 2017.
World number one Rafael Nadal squeezed past Croatian Marin Cilic with a 7-5, 7-6(3) victory on Saturday to set up a mouth-watering clash with Swiss Roger Federer in the Shanghai Masters final.
Second-ranked Federer came from behind to beat Argentine Juan Martin del Potro 3-6, 6-3, 6-3 to ensure he would meet Nadal for the fourth time this year in Sunday's final.
Nadal leads the head-to-head with Federer 23-14 but has not beaten the Swiss in 2017, losing in the finals of the Australian Open and Miami Masters and in the last-16 at Indian Wells.
The Spaniard was pushed hard by fourth seed Cilic, who put his booming forehand to good use but could not stop Nadal claiming a 16 consecutive victory.
"We are at the highest level of our sport, so nobody wins easy," Nadal said. "If you want to compete in the most important events... you're going to have tough matches and today was one of them."
Federer, the only man who can still stop Nadal ending the year as world number one, lost to Del Potro in the U.S. Open quarter-finals and looked set for a second consecutive defeat after tamely surrendering the first set.
The Swiss changed his approach in the second, following his serves into the net more often to take time away from the Argentine and the strategy worked as Del Potro failed to earn a single break point in the final two sets.
Nadal forced Cilic to save six break points in his first two service games, but the Croat hung on and passed up a glorious chance to go ahead himself when he squandered three break points with the score tied at 5-5 in the first.
Nadal then broke the world number five before serving out the set.
The Spaniard looked set for victory when he broke again early in the second, but Cilic drew level in the sixth game as Nadal pounded the net cord in frustration after missing an easy volley with his opponent stranded.
A flurry of Cilic errors gave Nadal three break points with the second set tied at 4-4.
The Croatian got out of trouble with three big serves but double faulted to hand the initiative back to Nadal and skied a forehand to give his opponent the chance to serve out the match.
Nadal failed to capitalise, squandering a match point before Cilic unleashed two massive forehands to level again at 5-5 as the set headed towards a tiebreak where Nadal's ability to hold his nerve in clutch situations proved the difference.
Sharapova storms through to final
Former world number one Maria Sharapova eased past defending champion Peng Shuai 6-3, 6-1 at the Tianjin Open on Saturday to reach her first WTA final in almost two and a half years.
Sharapova, who returned to the tour in April following a 15-month doping ban, will meet teenaged Belarusian Aryna Sabalenka, who is ranked 102 and made her first WTA final after beating Italy's Sara Errani 6-1, 6-3 in the other semi-final.
The Russian, who is currently ranked 86, broke her Chinese opponent in the opening game and rarely looked troubled on her own serve.
Peng, ranked number 25 in the world, had no answer to Sharapova's power hitting from the baseline and gave up another break en route to conceding the first set.
Sharapova, who is yet to drop a set in Tianjin, raced into a 3-0 lead at the start of the second but suffered a brief bout of nerves while serving for the fifth game, when she was forced to save three break points.
The 30-year-old turned the tables on Peng in the very next game, breaking her opponent once again before closing out the contest in 78 minutes.
It will be Sharapova's first WTA final since she defeated Spain's Carla Suarez Navarro to win the Italian Open in May 2015.