Basel - Third-seeded Rafael Nadal battled back from a break down in the final set to defeat Grigor Dimitrov 6-4, 4-6, 6-3 on Wednesday to reach the Swiss Indoors quarter-finals.
But second seed Stan Wawrinka suffered his eighth first round loss at the tournament as the French Open champion slumped to a 3-6, 7-6 (7/2), 6-4 defeat to Ivo Karlovic.
Nadal won the opening set against Dimitrov but dropped the second after leading 4-2.
When he dropped serve in the opening game of the third set on a double-fault, the situation looked grim for the Spaniard.
But the 14-time major winner broke back for 5-3 with a winning overhead, serving out the tight victory a game later after more than two hours on court.
"This was another very tough match, I had to fight," said Nadal. "But to win this way was fantastic.
"I'm very happy to be in the quarter-finals. Winning like this gives me confidence after my second important win this week."
Nadal next faces either Marin Cilic or Teimuraz Gabashvili for a semi-final spot.
Karlovic, the 36-year-old Croatian, sent down 21 aces to take victory over Wawrinka after trailing a set and a break.
"I had a poor first set and was missing a lot with my volleys," said Karlovic.
"But I began improving in the second set and got a bit lucky when I converted my break points (in the sixth game at 3-3). After that, things started going my way."
Karlovic, who had lost five of six previous meetings with Wawrinka, next plays Serbia's Dusan Lajovic.
Wawrinka was disappointed to have let it slip away.
"It's never easy to lose a match like that, especially since I felt I was playing well and feeling good. I had my chances to take control of the match," said the Swiss.
"After the first set, everything was good, I was playing well. I played really good for two sets, more or less. I had a few mistakes, but it can happen.
"He's playing his best year so far, he's improved his game a lot. He serves amazing and you don't get many chances. Today I got my chances and didn't take them."
ANDERSON FIRES 29 WINNERS
Elsewhere in the opening round, fourth seed Kevin Anderson advanced over Croatian teenager Borna Coric 6-3, 6-2, while seventh seed and last weekend's Moscow champion Cilic beat Basel native Marco Chiudinelli 6-3, 7-6 (7/3).
South Africa's Anderson sent down 29 winners, improving his record in the best season of his career to 45-22.
Jack Sock won an American battle with Denis Kudla 6-4, 6-2 and next faces countryman John Isner, the sixth seed.
Russia's Gabashvili stopped Argentina Leonardo Mayer 7-5, 4-6, 6-4.
In the second round, 2014 finalist David Goffin made the quarter-finals with a 6-4, 6-3 win over Adrian Mannarino.
Results from the third day of the ATP Swiss Indoors on Wednesday (x denotes seeding):
David Goffin (BEL x8) bt Adrian Mannarino (FRA) 6-4, 6-3
Rafael Nadal (ESP x3) bt Grigor Dimitrov (BUL) 6-4, 4-6, 6-3
Kevin Anderson (RSA x4) bt Borna Coric (CRO) 6-3, 6-2
Jack Sock (USA) bt Denis Kudla (USA) 6-4, 6-2
Marin Cilic (CRO x7) bt Marco Chiudinelli (SUI) 6-3, 7-6 (7/3)
Teimuraz Gabashvili (RUS) bt Leonardo Mayer (ARG) 7-5, 4-6, 6-4
Ivo Karlovic (CRO) bt Stan Wawrinka (SUI x2) 3-6, 7-6 (7/2), 6-4