Top seed Roger Federer stayed on course for a seventh title at his home tournament in Basel but was given a slight scare by David Goffin as he prevailed 6-3, 3-6, 6-1 on Friday to reach the Swiss Indoors semifinals.

Third seed Rafael Nadal of Spain was given a stern examination but eventually fought back to shake off Marin Cilic 4-6, 6-3, 6-3 to also make the last four as a potential final showdown with old rival Federer looms.

Nadal will play No. 5 seed Richard Gasquet next after the Frenchman beat Ivo Karlovic of Croatia 6-4, 6-7 (2-7), 7-6 (7-6), keeping alive his outside hopes of making next month's World Tour Finals in London involving this year's best eight players.

Federer's semifinal opponent on Saturday will be Jack Sock after the American overcame compatriot Donald Young 5-7, 6-4, 6-2.

The Swiss was knocked out of his last tournament in Shanghai in his opening match but has been in decent form back home.

The first set against Goffin flew by with Federer at his clinical best, taking the one break point on offer while saving two on his serve with some sumptuous shots mixed with the careless errors that have crept into his game in recent years.

The Belgian thoroughly deserved to level in the second and Federer had to shift gears to race through the final set, with the extra backing of his home crowd a definite factor.