Federer struggled in the opening set, and even walked toward his chair early in the first game before realizing there was still a point to play.
Istomin had taken just a set off Federer in five previous meetings, last year in Basel, but the Uzbekistan player took the lead after breaking in the sixth game.
Istomin battled to stay in the match and saved seven break points in the final set before finally succumbing to Federer in the third game and the second-ranked home favorite went on to clinch the match with a love service game.
Federer, who is looking for his sixth Swiss Indoors title after finishing runner-up in the past two editions, next faces fifth-seeded Grigor Dimitrov after the Bulgarian eased past Vasek Pospisil of Canada 6-2, 6-2.
Ealier, fourth-seeded Milos Raonic of Canada hit 22 aces, including on match point, to beat Donald Young of the United States 6-4, 6-7 (5), 7-6 (2).
Raonic earned the only break of the match to take the opening set and then dominated the final-set tiebreaker, converting his first of four match points to seal the win after nearly 2 hours, 20 minutes.
Raonic, who beat Young in two sets in Washington earlier this year, next faces Belgium’s David Goffin.
Eighth-seeded Ivo Karlovic also advanced after coming from a set down to defeat qualifier Kenny De Schepper of France 6-7 (6), 6-4, 6-3 in just under 2 hours.
The Croatian will face Benjamin Becker in the quarterfinals. The German eased through after Mikhail Kukushkin, who had upset Stanislas Wawrinka in the opening round, retired when trailing 6-7 (3), 7-6 (4), 4-0.
Borna Coric set up a quarterfinal against childhood idol Rafael Nadal as the 17-year-old Croatian comfortably beat Andrey Golubev 6-4, 6-4.