Shanghai, China: Reigning champion Roger Federer was pushed all the way for the second match in a row before beating Roberto Bautista Agut to squeeze into the Shanghai Masters quarterfinals on Thursday.
The top seed and 20-time Grand Slam winner emerged from another nervy battle to eventually defeat the 28th-ranked Spaniard 6-3, 2-6, 6-4.
He will play the Japanese eighth seed Kei Nishikori in the last eight, while Novak Djokovic and Alexander Zverev are also through, albeit with far less hassle.
The 37-year-old Federer had been forced to fight in his opening match on Wednesday, admitting that he came "very close" to defeat against Russia's Daniil Medvedev.
Normal order appeared to have been resumed when the Swiss comfortably claimed the first set against Bautista Agut.
But the unseeded Spaniard earned a piece of personal history after that, winning the second set -- the first time he had ever done that against the Swiss maestro.
The 30-year-old Bautista Agut had the whiff of an upset in his nostrils and the prospect of a first victory over the Swiss at the eighth attempt.
But in the ninth game of the deciding set, Federer made the breakthrough on his opponent's serve, pumping his fist as another hard-won victory loomed into view.
Djokovic enjoyed a measure of revenge as he booked his spot in the quarter-finals with a 6-4, 6-0 demolition of Marco Cecchinato.
The Serbian second seed was stunned by the Italian -- ranked 72 in the world at the time -- in the French Open quarter-finals earlier this year. Djokovic will play South Africa's seventh seed Kevin Anderson.
Rising star Zverev was similarly emphatic as he brushed aside Australia's new number one, teenager Alex de Minaur, 6-1, 6-4.
The German fourth seed will face 11th seed Kyle Edmund in the last eight.