Raonic, 25, broke the 17-time Grand Slam champion once in each set to win the final, only his second win over Federer in 11 meetings.
Federer, who had been improving every round after starting the tournament with a slight illness, was no match for Raonic, who served powerfully and came to the net at every opportunity.
The win gave Raonic his eighth title on the ATP tour and reversed the result of last year’s final, won by 34-year-old Federer in three tight sets.
Federer was off his game throughout, serving at only 55 percent and struggling to make any impression on the big-hitting Canadian.
The top seed had to save two break points in the fifth game of the first set and then faced another two in the ninth.
He saved the first but put a forehand into the net on the second to go behind 4-5. Raonic had no trouble serving for the set, wrapping up the opener in 41 minutes.
Raonic took a medical time-out at 2-1 in the second set to have treatment on his right leg. When he returned he served four double faults to give Federer his first break point of the match.
But Federer was unable to take advantage and games remained on serve until the seventh game, when Federer let a 30-0 lead slip to give Raonic a break point, then netted a backhand to give the Canadian the vital break.
Raonic, who only faced the one break point in the match, never looked like faltering and claimed the title when a Federer backhand sailed long.