On Monday, Federer will begin a record-extending 310th week at the top of the rankings and a third spell this year alone as No. 1 before seeking to defend his Halle grasscourt crown.
Kyrgios forced a minibreak in the deciding tiebreak, but Federer remained steady and sent a short backhand past his opponent on his first match point to clinch the win 6-7 (2-7) 6-2 7-6 (7-5). "I fought hard. When you finally manage it, the joy is even greater", said Federer, who extended his grass-court winning streak to 16 matches including his titles at Halle and Wimbledon past year.
"I'm so happy to win this tournament in my third attempt".
Victory in Germany cements Federer as the World Number One ahead of the defence of his Wimbledon title on the grass of SW19.
The 20-time Grand Slam champion had already secured his return to number one in the world rankings with victory over Nick Kyrgios in the semi-final.
He takes the honour back from Rafael Nadal for the second time this season and continues the duel on court between the two modern icons.
Mohamed Salah In Apparent Discomfort In Egypt Training
"He didn't play today because we didn't want to have any risk or danger", Egypt coach Hector Cuper said. Egypt take on hosts Russian Federation in St Petersburg on Tuesday.
Raonic, who sat out some clay-court tournaments, including the French Open, with an undisclosed injury last month, fell 6-4, 7-6 (3) to Federer in Sunday's title match on grass.
"I think I played very well not having played for a while", Federer added. "Maybe I had a bit of an advantage because I get free points with my serve, but he was also serving extremely well".
The Swiss got his hands on the Mercedes Cup with a straight sets win over the Canadian - who hadn't been broken throughout the week before meeting the top seed.
"He slipped up a few points early I played a few points well". Since the beginning of the 2017 season, Raonic has appeared in two finals: May 2017 at the Instanbul Open and the DelRay Beach Open, where he retired, but he had yet to make an appearance in a tournament final this year.
"I created some opportunities". We will see. Then I will fly to Halle tomorrow (Monday), probably playing my first match on Tuesday. "Today didn't go the way I wanted, but I'm looking forward to building on this result".