Roger Federer believes Rafael Nadal has forced him to improve his game as the duo prepare for the latest instalment of their storied rivalry at the Shanghai Masters.

Nadal battled past Marin Cilic 7-5 7-6 (7-3) in Saturday's opening semi-final, before Federer fought back from a set down to overcome Juan Martin del Potro 3-6 6-3 6-3.

The Spaniard enjoys a 23-14 head-to-head record over his great foe although each of the last four meetings have gone the way of the Swiss, including this year's Australian Open and Miami Masters finals.

For Federer - whose win over Del Potro was his 350th at Masters events - defeat to Nadal would all-but end his hopes of finishing the year as world number one, but the 36-year-old is happy to focus on the prospect of entering another chapter in this rivalry for the ages.

"It's nice at this late stage of the career that we still have these matches going on," Federer said.

"There is only going to be a few chances for either player, and sometimes it's just who blinks at the wrong time.

"I'm not sure what the [head-to-head] stat is because most of them, half of them, maybe, were in finals and that's why the rivalry is so special.

"I enjoy playing against him even if the head-to-head is not in my favour. He's one of the guys who's made me a better player. I don't want to thank him for that, but it made me go back and rework my game."

Nadal comes into Sunday's showdown hoping to extend his 16-match winning run and claim his first Shanghai title, which would take his tally to seven for the year. Federer, meanwhile, seeks to pull level with the Spaniard on six.

"I'm very happy. I played, I think, a very high level of tennis," Nadal said following his battling win over Cilic.

"[It] was a great match again. In my opinion, he played well, too. It was a great quality of tennis this afternoon."