Basel - Roger Federer was put to the test at his home Swiss Indoors event on Wednesday but conjured up a 6-3, 6-7 (6/8), 7-5 defeat of Thomaz Bellucci to advance to the quarter-finals.
The champion at five of the last six editions needed all of his guile at the end to advance in just over three hours with eight aces and two breaks of serve.
Federer has now won 31 of his last 32 matches here, with his only loss coming against Novak Djokovic in the 2009 final.
The hometown star, who got his first exposure to the game as a ballboy at the venue profitted, from a day off on Tuesday while Bellucci, weekend Moscow finalist, had to go three sets previous evening.
"It was a tough match but a very enjoyable one," said 17-time Grand Slam champion Federer, seeking his 77th title.
"I maybe had some luck at the end.
"I also had a rest while he was playing yesterday after a long trip. But Thomaz played really well, I had to work for this one."
Federer had a successful experiment with serve-and-volley tactics, mainly in the opening set, which he won in half an hour.
But Bellucci took the second into a tie-breaker, with Federer fighting to save four set points before finally losing on the fifth. It took a deciding set for the world No 1 to advance with his 66th season victory.
"I was very satisfied with how I played. All of the others play well against me, they raise their games for these matches."
Second seed Juan Martin del Potro overcame a first-set back problem to make a winning 6-4, 6-1 start over Alejandro Falla.
The South American battle finished in just under 90 minutes with del Potro running away with the second set.
"I was feeling tight in some parts of my body, but it was nothing dangerous," said the winner, "I will take care of it and be ready for my next match,
"I still made a good start to this event, I couldn't serve huge like last week in Vienna. But I won in two sets and that's good for the confidence and for saving energy for the next match."
Del Potro is hunting for one of two remaining spots in the eight-man year-end championships in London from November 5, standing provisional seventh ahead of French back injury victim Jo-Wilfried Tsonga and number nine Serb Janko Tipsarevic, who quit this week - as did Tsonga - with a physical problem at the Valencia event.
"Qualifying for London is very important for me," said Del Potro. "I'm very excited to be so close, it's a big goal.
"But I've not qualified yet. I need to win more matches. I hope to get there either this week or next."
There was trouble for two other seeds, with Frenchman Benoit Paire upsetting last week's Moscow titleholder Andreas Seppi, the number five seed, 4-6, 6-2, 6-3.
Australian Marinko Matosevic put out Florian Mayer, the German seventh seed, 6-2, 6-3. Paul-Henri Mathieu of France beat Swiss-Finn Henri Laaksonen 6-2, 7-5.
Bulgarian Grigor Dimitrov joined Federer in the last eight with his defeat of Frenchman Julien Benneteau 7-6 (7/5), 6-7 (1/7), 7-6 (7/3).
Results on Wednesday from the Swiss Indoors ATP event on indoor hardcourts at St Jakobshalle (seedings in parentheses):
Juan Martin del Potro (2), Argentina, def. Alejandro Falla, Colombia, 6-4, 6-1.
Benoit Paire, France, def. Andreas Seppi (5), Italy, 4-6, 6-2, 6-3.
Marinko Matosevic, Australia, def. Florian Mayer (7), Germany, 6-2, 6-3.
Paul-Henri Mathieu, France, def. Henri Laaksonen, Switzerlnd, 6-2, 7-5.
Roger Federer (1), Switzerland, def. Thomaz Bellucci, Brazil, 6-3, 6-7 (6/8), 7-5.
Grigor Dimitrov, Bulgaria, def. Julien Benneteau, France, 7-6 (7/5), 6-7 (1/7), 7-6 (7/3).