Roger Federer recovered from a slow start to reach the quarter-finals of the Swiss Indoors Basel with a straight-sets win over Jan-Lennard Struff.

The eight-time champion was 3-1 down in the first set of his second-round encounter on Thursday, but won six games in row to take the first set and went on to wrap up a 6-3 7-5 victory.

Federer has now won 17 consecutive matches in his hometown since losing to Juan Martin del Potro in the 2013 final and will face Gilles Simon or Ernests Gulbis in the last eight.

The 20-time grand slam champion had a first-serve percentage of only 53 and was some way off his best, but Struff made too many errors as the home favourite did enough to get the job done in two sets.

Federer made hard work of beating Filip Krajinovic in the first round and looked rusty early on two days later, gifting Struff a break for a 2-1 lead with two stray inside-out forehands.

The world number three got into his stride, hitting back to level at 3-3 with great anticipation and athleticism, then broke again to lead 5-3 following a string of unforced errors from Struff. 

Struff was a set down in the blink of an eye when he crashed a return into the net after such a promising start, but halted Federer's momentum by channelling his aggression much more effectively in the second set.

Neither player was given a scent of a break until Federer grasped his opportunity to take a 6-5 lead, a poor volley from Struff at the net costing him.

Federer served out the match to love, guiding a simple forehand away after dictating a rally to move a step closer to a 99th ATP World Tour singles title.