Roger Federer struggled into the Swiss Indoors semifinals on Friday, the top seed eking out an error-filled 7-6 (7/1), 4-6, 6-4 defeat of Gilles Simon.
Federer has not hit top form all week in Basle and he needed more than two-and-a-half hours to hold off the battling French veteran.
“I’m always happy when I win, I’m happy I fought through like this,” Federer said. “There were a lot of breaks, it was all up and down.
“But I kept my cool and got the job done. I feel good right now.”
The Swiss crowd favourite was never able to comfortably take command against an opponent whom he had defeated in their last six meetings.
It took a fightback in all three sets to come through for a place in a 14th semifinal at the event where he got his start in the game as a ballboy.
The 20-time Grand Slam champion will have to re-group quickly for the semis, where he will play the winner from Greek breakthrough player Stefanos Tsitsipas and Daniil Medvedev.
Earlier, second seed Alexander Zverev hammered a dozen aces to reach the final four with a 7-5, 6-3 defeat of Roberto Bautista Agut.
Zverev owns three titles this season, form Munich, Madrid and Washington, and will be looking to make Basel a fourth.