Rafael Nadal and Roger Federer will meet in Sunday’s final of the Shanghai Masters, just the latest chapter in their storied rivalry.

The celebrated duo have faced one another 37 times, with the Spaniard and world number one Nadal winning 23 of their contests.

And the 31-year-old Nadal, who has never won the Shanghai Masters, will be slight favourite this time because he goes into the showdown on a terrific run of form, and his opponent faces a quicker turn around.

Nadal, a 16-time Grand Slam champion, triumphed at the US Open and then last week at the China Open for his sixth title of another remarkable campaign.

But he was forced to survive a rollercoaster with fourth seed Marin Cilic in their semi-final, saving three set points in the opener before pulling through 7-5, 7-6 (7/3).

The Swiss Federer, the world number two chasing a second Shanghai crown, rolled back the years to fight back from a set down and defeat Juan Martin del Potro 3-6, 6-3, 6-3.

The 36-year-old Federer had said that he wanted revenge over the 16th-seeded Argentine for defeat in the quarter-finals at the US Open this summer.

And he got it.

Del Potro, the 2009 US Open champion whose career has been blighted by wrist injuries, quickly allayed fears that his latest problem would be a major handicap.

The 29-year-old fell and hurt his left wrist in winning his quarter-final on Friday and there were suggestions he may not even make Saturday’s match.

But he showed no ill effects in stunning the pro-Federer crowd to break for 4-2 in the first set.

And Del Potro grasped set point following a thrilling rally that had the spectators whooping, only for 19-time Grand Slam champion Federer to inexplicably shank his volley out of the court.

The second set went with serve until Federer, going after a 94th singles title, made the breakthrough on the Del Potro serve to inch ahead.

Del Potro began showing irritation, engaging in a series of discussions with the umpire, including demanding Federer be warned for triumphantly hitting the ball away after winning the game.

Federer sent the match into a deciding third set and he got the break early to tee up another Nadal meeting.

Federer, the older man, could be at a slight disadvantage because he has a shorter time to rest having played the second match of the day.

‘Tough match’

Croatia’s Cilic had only ever got the better of Nadal once in five previous meetings, but he made him work hard for this latest win.

Nadal said he was just glad to be in the final.

“The way doesn’t matter,” he said with a smile.

“We are at the highest level of our sport so nobody wins easy.

“And if you want to compete in the most important events of the year and try to go for the victories, for sure you’re going to have tough matches, and today was one of them.”

Nadal put Cilic under immediate pressure in the Croat’s first two service games.

But the 29-year-old Cilic, the 2014 US Open champion, eventually settled, only to squander three set points as Nadal hung on grimly.

In the next game Nadal capitalised, breaking Cilic on the way to claiming the first set.

With the crowd firmly in his favour, the Spaniard broke Cilic again in the third game of the second set, only for Cilic to break back for 3-3 when Nadal put his simple volley into the net.

They exchanged a further break apiece to race into the tie break, before a grateful Nadal pulled away at the last.