Roger Federer said he "never imagined" he would be world number one again as he moved to within one victory of being the oldest man to achieve that feat.

The Swiss 20-time Grand Slam champion beat Germany's Philipp Kohlschreiber 7-6 (10-8) 7-5 to reach the quarter-finals of the Rotterdam Open.

If Federer, 36, beats Robin Haase in their last-eight tie on Friday, he will replace Rafael Nadal at the summit.

"I've struggled to try and get there. I had to win a lot of matches," he said.

Federer, who became world number one for the first time in February 2004, has not topped the rankings since October 2012 and slipped to a low of 17th in January 2017.

That was after he spent six months out recovering from an operation on a knee problem.

However, he has since won eight titles, including Wimbledon last year and two Australian Opens.

The oldest number one previously was eight-time Grand Slam winner Andre Agassi, who was 33 when he last topped the rankings in September 2003.

Federer had to work hard against Kohlschreiber to maintain his hopes, though, prevailing in a 54-minute first set after a lengthy tie-break.

The second set was no less attritional, with Federer breaking for the only time in the contest to go 6-5 ahead before serving out to clinch a quarter-final place on his second match point.

"Tonight was complicated, I had to fight and struggle," he said. "I had a good gameplan going in, but I was never able to completely pull it off."