The 32-year-old Federer found the kind of form that has often eluded him in a difficult season and saved three straight set points against the 22-year-old Dimitrov when trailing 5-3 in the second set.
The sixth-ranked Federer was never threatened in the tiebreaker against No. 22 Dimitrov, who won his first career title last week in Stockholm.
Federer will face 40th-ranked Vasek Pospisil in the semifinals on Saturday.
Del Potro, who beat Federer in the 2012 final, will play French doubles specialist Edouard Roger-Vasselin in the semifinals.
After winning just one title this season, Federer hoped the home comforts of Basel could spark a strong finish to the season and seal his place at the ATP World Tour Finals in London next month.
He will qualify if he wins his sixth Swiss Indoors title ahead of the last regular tour event next week in Paris.
Federer was quickly in trouble Friday in his opening service game, trailing 0-40 and saving five break points before holding.
He broke to lead 4-3 with a forehand winner and clinched the set on Dimitrov's serve.
Federer double-faulted to concede a break in the third game of the second set, but broke back for 5-5 when Dimitrov sent an overhead beyond the baseline.
On match point, Federer hit a serve that Dimitrov could not handle, prompting a roar of relief from his Swiss fans.
Del Potro had a more routine victory, hitting 11 aces and never facing a break point against the 101st-ranked Mathieu.
"I've been working a lot on my serve to have this kind of match," said the No. 5 Del Potro.