Roger Federer staged a 6-7 (2-7), 6-2, 7-6 (7/5) comeback on Saturday over Nick Kyrgios to reach the Stuttgart Cup final and take back the world number one ranking.

The 36-year-old Swiss will resume his place at the top of the ATP rankings for the sixth time in his career on Monday, beginning a record 310th week at the summit of the men’s game.

His upward move will leave Rafael Nadal on second as the countdown to Wimbledon intensifies with a fortnight left prior to the start of the grasscourt major.

Top seed Federer will play for the 98th title of his career on Sunday against Milos Raonic.

The Canadian hammered 19 aces to eliminate defending champion Lucas Pouille 6-4, 7-6 (7/3).

Federer stands 10-3 over Raonic, Wimbledon finalist in 2016 against Andy Murray.

The Swiss, who owns 20 Grand Slam singles titles, needed to fight all the way against Australian threat Kyrgios, playing his first event in two months due to injury.

Federer dropped the opening set in a tiebreaker but roared back in the second with a pair of breaks to level at a set each.

The third set was tight all the way into the tiebreaker, with Federer erasing a 3-1 deficit.

The heavy crowd favourite at the Weissenhof Club earned a match point with a high overhead backhand winner and finished off the popular victory seconds later to the roar of fans after just under two hours.

Raonic, plagued by injury over the past few seasons, is making his Stuttgart debut.

The Canadian seventh seed feels his game is starting to fire again.

“I have nothing to complain about, everything is going positive,” he said.

“I’m playing better with each match, I’m there at the important moments in the games, that’s an important thing.”

The 35th-ranked Raonic beat the second-seeded Pouille for the third time without a loss in the series and said he is not allowing any thoughts of Queen’s club next week or Wimbledon enter his mind.

“I’m just concentrating on the job to hand, trying to do it well. If I can play well, I’ll be having my chances on the grass.”

The Canadian saved the lone break point he faced while breaking Pouille twice.

“Reaching the final is an important step for me,” he said. “There is a big difference between playing a semi and a final.

“I’m making positive progress, I’m happy with it and hope to keep it up tomorrow.”

Raonic played his last final in May, 2017, losing in Istanbul to Marin Cilic.

His last grass final came at 2016 Wimbledon in a loss to Andy Murray.