Federer's win over Nadal was a fifth straight against his longtime rival. That streak started in Basel in 2015 when Federer won the final of his hometown tournament.
Maria Sharapova, who won the Tianjin Open two days ago, brought her usual power but lacked accuracy with some wild swings on key points.
Alize Cornet won a frantic match which included five consecutive breaks of serve in the first set.
Maria Sharapova is looking for a strong finish to a season that began with a doping ban and hit a high in China when she won her first title in over two years.
Federer claimed his 94th title and sixth this year with an emphatic defeat of Nadal in the Shanghai final and is hungry for a first ATP Finals win since 2011.
Roger Federer brushed aside world number one Rafael Nadal 6-4 6-3 to win the Shanghai Masters on Sunday and register his fourth victory of the year over his Spanish rival.
Maria Sharapova, whose last title came at the Italian Open in May 2015, had three match points but Sabalenka survived them all before double faulting.
Roger Federer defeated Rafael Nadal 6-4, 6-3 in the final to win the Shanghai Masters title on Sunday.
Rafael Nadal vs Roger Federer: Shanghai Masters final will see World No 1 take on World No 2 with Nadal on a 15 match winning streak.
Sixth-seeded Anastasia Pavlyuchenkova is chasing her third WTA singles title this year and faces Daria Gavrilova of Australia in the final.
Rafael Nadal, who won a tour-best sixth title of the season at the China Open last week, has now beaten Marin Cilic in five of their six matches.
Maria Sharapova 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.
Federer, who is currently in Shanghai for the ATP Masters series, met the Warriors in their dressing room last weekend after they played a pre-season match with the Minnesota Timberwolves in China.
Roselyne Bachelot alleged that Rafael Nadal faked an injury in 2012, when he missed the final six months of the season, in order to hide a positive drug test.
Juan Martin del Potro's bruised left wrist was placed in a splint after a nasty fall while winning his quarterfinal at the Shanghai Masters on Friday.
The highest ranked player left in the Hong Kong Open, Anastasia Pavlyuchenkova of Russia beat Naomi Osaka of Japan 6-3, 6-3 in the quarterfinals on Friday.
Juan Martin del Potro headed to a hospital for a scan on his left wrist after a nasty fall while winning his quarterfinal at the Shanghai Masters on Friday.
It was second final of the season for the left-handed Divij Sharan on the Challenger Tour, having won the title at Bordeaux, France with Purav Raja.
Next up for 30-year-old Rafael Nadal is Croatian Marin Cilic, who beat Albert Ramos-Vinolas 6-3, 6-4 in another quarter-final.
Maria Sharapova was broken in the first game but fought back to draw level before going on to take the first set with a hold to love.
Rafael Nadal needed two minutes over the hour to dispatch Fabio Fognini, taking his winning streak to 14 matches since the start of the US Open.
Maria Sharapova prevailed 7-5, 6-3 and will make her first quarterfinals appearance since Stuttgart in April, where she lost to Kristina Mladenovic in the next round.
Del Potro required four match points - two on Zverev's serve in the ninth game, two on his own serve in the 10th - to win this first encounter career against the German.
Caroline Garcia became the eighth and final player to qualify for WTA Finals after Johanna Konta withdrew from the Kremlin Cup.
Alexander Zverev advanced to the third round after Aljaz Bedene retired from their match with a right knee injury while trailing 4-0.
Grand Slam Board said that Fabio Fognini was provisionally suspended for two grand slam tournaments and fined $96,000 for his outburst at this year's US Open.
Rafael Nadal lost only four points in a 6-2, 6-1 victory over Jared Donaldson in the second round of the Shanghai Masters.
Naomi Osaka fought back from an early break to stun Venus Williams 7-5 6-2 in Hong Kong Open.
Nick Kyrgios had just been beaten in a tiebreak against Steve Johnson when he walked to the net, offered his hand to the American and stormed off court.
Nick Kyrgios said a stomach bug and a shoulder problem had forced him to retire after losing the first set in his Shanghai Masters first-round match against American Steve Johnson on Tuesday.
Venus Williams will headline the Sydney International in January to kick off her 2018 season, returning to the tournament after a 20-year absence.
Last year, Kyrgios was suspended by the men's tour for "tanking'' a match and insulting fans following a second-round loss to German qualifier Mischa Zverev at the Shanghai Masters.
Serena Williams will make her competitive comeback to tennis next January to defend her title at Australian Open, organiseres feel.
Firebrand Australian Nick Kyrgios believes he has found his life's purpose in helping underprivileged children and he is planning to set up a facility for them in Melbourne.
Juan Martin del Potro needed all three sets to reach the second round at the Shanghai Masters, beating Georgian qualifier Nikoloz Basilashvili 6-2, 3-6, 6-4.
Caroline Garcia's China Open triumph gave her a second consecutive title after winning the Wuhan Open crown last month.