The Swiss had not played since the Miami Open in March, after choosing to miss the clay-court season, but the win in Germany gives him a 98th Tour title.
Federer, 36, beat Canadian Raonic 6-4 7-6 (7-3) in the final.
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.
The only break of serve came in the third game of the match with Federer clinching it with a backhand winner.
The second set was again tight as both players’ serve dominated on the grass court but Federer edged it on a tie-break.
“I played very well throughout the tournament, it is a great comeback for me. I am so happy to have won,” said Federer.
“I was hoping to play a couple matches here but I have played four and won them all. The last few have been very good.
“I hope I keep it up at Halle and Wimbledon. It will give me a boost as well being back at world number one.”
Federer also sat out the clay-court season in 2017 but last year lost on his return in Stuttgart before going on to win the Gerry Weber Open in Halle and claim an eighth Wimbledon title.
He will again compete at Halle next week, aiming for a record 10th title, before Wimbledon which begins on 2 July.
Elsewhere, Richard Gasquet earned his first title of the year and the 15th of his career after beating fellow Frenchman Jeremy Chardy to win the Libema Open at s’Hertogenbosch in the Netherlands.
The 31-year-old, who had not won a grass court title since the first two tournament wins of his career in Nottingham in 2005 and 2006, beat Chardy 6-3 7-6 (7-5).
Federer has won a record eight Wimbledon titles, a joint-record six Australian Open titles, a record five consecutive US Open titles, and one French Open title. He is one of eight men to have captured a career Grand Slam. Federer has reached a record 30 men’s singles Grand Slam finals, including 10 in a row from the 2005 Wimbledon Championships to the 2007 US Open. Federer has also won a record six ATP Finals, 27 ATP World Tour Masters 1000 titles, and a record 20 ATP World Tour 500 titles. Given these achievements, many players and analysts consider Federer the greatest tennis player of all time.
Federer’s all-court game and versatile style of play involve exceptional footwork and shot-making. Effective both as a base-liner and a volleyer, his apparent effortlessness and efficient movement on the court have made Federer highly popular among his fans. He has been voted by his peers to receive the tour Sportsmanship Award a record thirteen times and voted by tennis fans to receive the ATP Fans’ Favorite award for fifteen consecutive years. Federer has been named the Swiss Sports Personality of the Year a record seven times. He has been named the ATP Player of the Year and ITF World Champion five times, and he has won the Laureus World Sportsman of the Year award a record five times, including four consecutive awards from 2005 to 2008. He is also the only individual to have won the BBC Overseas Sports Personality of the Year award four times.





