Basel, Switzerland - Roger Federer had to fight hard to hold off Serbia's Filip Krajinovic on Tuesday, edging to a 6-2, 4-6, 6-4 win to reach the second round of the Swiss Indoors.
The eight-time champion flirted with his earliest exit in Basel since his 1998 debut as a teenager, but came out on top in a nervy deciding set.
"I also knew that he was feeling the pressure, that was something I needed," said Federer. "it was a very close win, very tough."
Earlier, Jan-Lennard Struff ended the possibility of a rematch between Federer and his US Open conqueror John Millman by beating the Australian 7-6 (7/3), 6-2.
Krajinovic appeared to be on the way to a straight-sets loss in his first meeting with the 20-time Grand Slam winner before the momentum began to turn.
Up a set and a break, the Swiss lost serve in the sixth game of the second set before his opponent managed to square the match with a break in game 10.
The top seed went up an early break in the third and broke Krajinovic in an 11-minute game for a 5-2 lead, only to fail to serve out the match at the first time of asking.
But he clinched victory on his second match point to take his career record at the tournament to 67-9 as he bids to reach a 12th successive final at St. Jakobshalle.
The 37-year-old Federer, who revealed earlier this week that he had been struggling with a hand injury since the grass-court season, last lost at the Swiss Indoors in 2013, going down to Juan Martin del Potro.
Seventh seed Daniil Medvedev, a semi-finalist last week in Moscow, saw off German Maximilian Marterer 6-3, 7-5.
Russian Medvedev stands at a career-high ranking of 20th, with three titles this season and will next face Andreas Seppi after the Italian defeated Japan's Taro Daniel 6-0, 6-4.
Results from the Swiss Indoors ATP tournament in Basel on Tuesday (x denotes seeding):
Jan-Lennard Struff (GER) bt John Millman (AUS) 7-6 (7/3), 6-2
Peter Gojowczyk (GER) bt Nicolas Jarry (CHI) 1-6, 7-5, 6-3
Andreas Seppi (ITA) bt Taro Daniel (JPN) 6-0, 6-4
Daniil Medvedev (RUS x7) bt Maximilian Marterer (GER) 6-3, 7-5
Alexei Popyrin (AUS) bt Matthew Ebden (AUS) 7-6 (7/4), 6-4
Roger Federer (SUI x1) bt Filip Krajinovic (SRB) 6-2, 4-6, 6-4
Gilles Simon (FRA) bt Leonardo Mayer (ARG) 6-3, 6-3