Doha: Novak Djokovic admitted he had to "fight" to come back from a set down to beat world number 36, Hungary's Marton Fucsovics at the Qatar Open on Wednesday.
The world number one survived a huge scare to eventually triumph 4-6, 6-4, 6-1 and admitted his opponent was "very close to the win".
"For the first two sets he was the better player," said two-time Qatar Open champion Djokovic.
"He played really well, smart, changing up the rhythm and the pace of the ball and moving me around.
"I was kind of in a corner and I had to find my way and fight my way through."
The match lasted exactly two hours, which was twice as long as the Serb spent on court in his first round stroll against Damir Dzumhur, where he lost just three games.
A backhand winner eventually secured victory for Djokovic but the result was in doubt for a long time, with the Serb only breaking Fucsovics in the tenth game of the second set to ensure the match went into a final set shootout.
Djokovic added: "I knew his qualities and especially in the slower conditions, so I did expect that it was going to be a match with a lot of rallies and very physical and that has proven to be the case."
The number one seed, will play fifth seed Nikoloz Basilashvili in the quarter-finals.
The Georgian beat Russia's Andrey Rublev, the 2018 runner-up, 6-3, 6-4 on Wednesday.
If he wins his last eight match, Djokovic is on course to meet Stan Wawrinka in the semi-finals after the Swiss also won on Wednesday, beating Chile's Nicolas Jarry 6-4, 7-6 (7/3).
Wawrinka plays Spain's Roberto Batista Agut in the quarters.
Also through is France's Pierre-Hugues Herbert who notched a second thrilling victory in as many nights by beating Germany's Max Marterer 6-3, 6-7 (6/8), 7-6 (8/6).
Herbert, who beat second seed and world number eight Dominic Thiem 24 hours earlier, will now play Tomas Berdych in the last eight, who won a three-set match against Fernando Verdasco, 4-6, 6-3, 7-5, in the last match of the night.