Federer's own serve lost some of its bite in the crucial game in the third set with the score tied at 5-5.
But he rallied for a third career win over Federer in five meetings, his first over the Swiss on hard courts.
Canada's Bianca Andreescu, 18, advanced to the women's final on Friday night with a thrilling three-set win over No. 6 seed Elina Svitolina of Ukraine.
Raonic rescued the only break point in the second set at 2-1 down before going on to force another tiebreak.
The 39th match between Roger Federer and Rafael Nadal failed to materialise on Saturday as the world number two Spaniard hobbled out of Indian Wells to send Federer into a title clash with Dominic Thiem.
"It is such a pleasure to compete with you, to learn so much from you, and to play with one of the biggest legends of all time".
Roger Federer came out firing in the final of the ATP Masters 1000 event at Indian Wells while Dominic Thiem needed a set to adjust to what he was seeing across the net. Novak Djokovic has lost the ground to great rivals in this segment a little bit before bouncing back in 2018, adding three finals to his tally to stand on 47 (the first player behind him is Andy Murray on 22), leaving Nadal and Federer as the leaders of the race towards 50 Masters 1000 finals in 2019!
Federer was playing in his fifth straight Indian Wells final but was not able to stop an impressive Thiem.
Trump remarks on Conways' marriage in feud with aide's husband
It was unclear what Trump meant by his assertion in his tweet that Kellyanne Conway had a role in denying her husband a job. Conway responded to Trump's Tuesday insults by retweeting them, writing: "You seem determined to prove my point".
Samsung’s Galaxy Fold shows up in a hands-on video from Vietnam
The handset features a 5.9-inch full HD+ Infinity U Super AMOLED display with 19:9 aspect ratio and 1080x2280 pixel resolution. If continued use is likely to create a dent in the screen, this will significantly damage a user's overall experience.
The Athletic College Basketball staff makes their Final Four, national champion picks
We deeply regret the error and extend our apology to the NCAA and the women's basketball community. The Central Michigan women's basketball became the surprise team of the 2018 NCAA tournament .
Who would have believed Bianca Andreescu would have won this title or that Dominic Thiem's biggest career title would be on a hard court of all surfaces?
The longtime foes have amassed 37 Grand Slam titles between them - Federer with 20 and Nadal with 17 - and built a unique relationship over 15 years and 38 prior matches, not to mention countless promotional and charitable activities off the court together.
"The way we go about it is very different, yet we both find a way to excel", Federer said. "We wanted to battle it out and we all know Rafa would have given it all he had, if he could have".
But Thiem was not about to go quietly, saving break points for a 2-1 lead in the second and breaking for a 3-1 lead as the Swiss suddenly couldn't put a first serve in.
"I'm not too disappointed", said Federer who was seeking a record 6th Indian Wells title, 101st overall.
The Austrian will take home $1.354million (£1.09m) in prize money for winning the tournament, while Federer walks away with $686,000 (£516k) as runner-up. "I feel like he had to come up with the goods, and it did feel like to some extent it was in my racket". I was in the points, ' he said.
'I think that was a really important five minutes in the match, ' Federer said.