Federer, a five-time champion in the city of his birth, played a second-set tiebreaker to perfection against the 22-year-old yesterday.
Seventeen-time major winner Federer also strengthened his position for a place in the eight-man World Tour Finals starting in London in 10 days.
He stands provisional seventh as he heads into a Saturday semi-final with Canadian Vasek Pospisil, who beat Ivan Dodig 7-6 (13/11), 6-4.
Federer could qualify for London if he wins a sixth title in Basel on Sunday, according to ATP calculations.
More From This Section
Federer was pleased to be finding some consistent from after one of the poorest seasons of his career.
He began with a wobble on Friday and was forced to save five break points in his opening service game against the Stockholm champion from last week.
"It was very important to win in two sets," said Federer.
"There were a lot of free gifts out there in some games.
"When I saved three set points (second set) I just told myself to play one point at a time and hope to get there. I broke him (for 5-5) and that made it difficult for him. I was able to come through well in the tiebreaker.
Top seed Juan Martin del Potro won his 300th career match as he marched into the semi-finals with a 6-4, 6-4 win over Paul-Henri Mathieu.