Roger Federer capped a fine return to action by winning the Stuttgart Open ahead of reclaiming the world number one spot on Monday.

Despite sitting out the clay-court season, Federer made his comeback in Germany knowing a place in the final would be enough to dethrone Rafael Nadal at the top of the rankings.

And having seen off Nick Kyrgios to achieve that goal on Saturday, the top seed defeated Milos Raonic 6-4 7-6 (7-3) in a contest decided by small margins.

A phenomenal backhand return to Raonic's serve secured an early advantage for Federer and, although the Canadian battled to prevent a second, a solitary break was enough to seal the first set.

Raonic found life a little easier in the second set, holding his serve throughout, but still created few opportunities to make a breakthrough against the top seed.

When Federer battled back from 0-30 at 5-6, a tie-break was in the offing and early mini-breaks were traded, with the pair again well matched.

However, the Swiss again showed his class, finally shaking off his opponent by claiming the last five points in a row to clinch his 98th title on the ATP Tour.