The 2014 winner of this tournament battled back from a set down to overcome Juan Martin del Potro 3-6 6-3 6-3 on Saturday afternoon, exacting some revenge for his US Open quarter-final defeat to the same opponent.
"Clearly getting the break and then holding, it's always key in tennis," he told reporters after the match. "I'm happy I was able to do it, especially with all the twists and turns and, blink at the wrong time, he might hold the game and then you don't know what's going to happen next."
Nadal beat Marin Cilic in straight sets, meanwhile, doing so in a time of just over two hours to set up a big showdown with Federer in the race to end 2017 as the world's top player.
Federer has won each of the last four meetings between the pair, most recently at the Miami Open in April, and is seeking his second crown in Shanghai.