Federer dropped just one set on his way to the final - against his fellow Swiss Stan Wawrinka - and won all but one of his 89 service games.
He broke Raonic's serve in the first game of their semifinal and comfortably won 6-4 6-4 6-4.
"My game's back where I hoped it would be from one year ago," he said. "Things were difficult for most of last year, so I'm happy I worked hard off the court to get myself back into shape and back into contention for tournaments.
"This year's been very solid. I've reached a lot of semis and finals. I've also won two titles already. So I think that really gave me the confidence to believe that I could go a step further."
Federer has won 18 of his 34 meetings with Djokovic. They have not met in a grand slam final since Djokovic's first, at the 2007 US Open, which Federer won. Their only meeting on grass, which Federer also won, was in the semifinals at Wimbledon two years ago.
He was made to work a lot harder in his semifinal, finally overcoming Bulgarian 11th seed Grigor Dimitrov 6-4 3-6 7-6 (2) 7-6 (7)
"It's a good chance for me to try to win against him on his favourite surface, on his favourite court," Djokovic said. "This is where he has had the most success in his career, winning many titles. He's been looking very good throughout the whole tournament.
"We know each other's games. We've played many matches on different occasions, only once on a grass court, but we played so many times in semifinals and finals of grand slams, on different surfaces in big matches over the years. They were very exciting and, of course, most of the matches we play against each other went the distance. I'm going to be physically ready and fit to go the distance this time."
While Djokovic has six grand slam titles to his name already, one of the main reasons why he brought Boris Becker into his coaching team at the end of last year was to improve his record at the sharp end of the biggest events. The Serb is well aware he has lost five of his last six grand slam finals.
"Of course I try to learn from those," Djokovic said. "I have the team of people around me that are experts in their own fields. They all try to help me out and analyse my game, as well as my mental approach. We will try to understand what I did wrong in the French Open final from a mental perspective, and to make it better."
- Independent