The Swiss 19-time grand slam winner, who still trails Nadal 23-15 in their overall head-to-head record, didn't face a break point and started and ended the match with service breaks.
"I don't know what my expectations were going in," Federer said. "I thought I might struggle early on because it was a late finish last night.
"I had no nerves before the match, surprisingly. I think I was pretty clear about how I wanted to play the match. I started off very well and relaxed from then on."
Despite his dominance in 2017, Federer doesn't rate his chances of catching Nadal in their head-to-head record.
"It's not going to happen. We don't have enough years left on the tour. We ranked too good so we play each other only in finals at the moment... You can't win them all against Rafa, to be honest. He's too good of a player," Federer said.
Federer took advantage of three of seven break point opportunities in the match to snap Nadal's 16-game winning streak, which included his China Open victory last week.
Federer, who has won the last five encounters between the pair dating back to the 2015 Basel final, also beat Nadal in the Australian Open final, a round of 16 match at Indian Wells and the Miami final this year.
"Have been a very difficult match for me," Nadal said. "He played very fast and he played well.
"Of course was not the best match for me of the week. When somebody plays better than you, sport is not very difficult. That's the real thing, no? When you play against somebody that is better than you in most of the things that really matters in this sport, in this kind of surface, then it's tougher."
The Shanghai Masters is Federer's 94th career title, moving him into a tie with Ivan Lendl in second place on the Open era list.
Nadal arrived on court with a bandage under his right knee, the same leg he twice smacked with his racket after losing his serve for the first time this week in the semifinal.
Federer said he was surprised to see the wrap and didn't feel Nadal was struggling with his movement.
In his post-match press conference, Nadal elected not to discuss the knee injury, saying, "I don't want to talk about that now, sorry, but after losing final is not the moment."
When asked if he would play upcoming tournaments in Basel, Switzerland and Paris, Nadal refused to confirm his participation.
Federer took advantage of a third break point in the first game of the match with a winning backhand passing shot. He broke Nadal's serve again on a second break point in the fifth game of the second set when Nadal sailed a backhand crosscourt wide. In the final game, Nadal netted a forehand at 15-40 to end the 72-minute match.