Defending Shanghai Masters champion Roger Federer avoided a third-round upset against Roberto Bautista Agut as he came through in three sets to clinch a quarter-final meeting with Kei Nishikori.
The Swiss, whose ranking as number two in the world is under threat this week, was broken three times in the second set to force a decider but eventually prevailed 6-3 2-6 6-4.
Bautista Agut had never even taken a set off Federer in their previous seven meetings but forced a decider only to be crucially broken at 4-4, and the Swiss served out to love to clinch the win.
Federer will now meet Nishikori, who he has not lost to since 2014, for the first time since the 2017 Australian Open.
Not quite# peRFect, but good enough. @rogerfederer's quest to defend his #RolexSHMasters title forges ahead with a hard-fought 6-3, 2-6, 6-4 win over @BautistaAgut . Gets No. 8 @keinishikori in tomorrow's quarterfinal! pic.twitter.com/2Cc6JV5YTt— RolexShMasters (@SH_RolexMasters) October 11, 2018
There were signs this was not going to be a straightforward evening for Federer early in the first set when Bautista Agut had a break point in the Swiss' second service game.
He could not capitalise, though, and Federer soon gained a 3-1 lead en route to taking the opener.
Federer won an 11-minute game at the start of the second set to break Bautista Agut again before the Spaniard instantly roared back and reeled off four games in a row.
Bautista Agut then forced a decider by breaking Federer for a third time, successfully winning a challenge to bring up set point, which he took when his opponent netted a backhand.
The third set remained on serve until, at 4-4, Federer claimed his first break since the start of the second set, and he capitalised to secure another hard-fought win having also beaten Daniil Medvedev in three sets on Wednesday.
"It was a very tough match, I thought it was a really high level," Federer said afterwards.
"They're tough conditions – the ball stays super low, it's fast, it's cooler.
"If you want to make the winner you have to take a lot of risks, it seems like. If you find a great groove, it's hard to go through the opponent."
|We have a hell of a lot to do - Paine slams Australia batting|
|Kerber and Osaka to meet at WTA Finals|
|Lorenzo out of Japanese MotoGP|
|Real Madrid handed Africa trip in Copa del Rey|
|Allegri: Ronaldo has sharpened Juventus focus|
|No Wade in Wasps squad amid NFL reports|
|Rooney: Five of us controlled Man United dressing room|
|Bayern bosses launch scathing attack on ´disrespectful´ media|
|Saints lock in Lawes to new deal|
|Adelaide United 1 Sydney 1: Debutant Le Fondre rescues a point|
|Madrid can´t look back, only forward - Lopetegui confident of revival|
|Wimbledon to introduce final-set tie-breaks|
|Abbas inspires Pakistan to series victory|
|Madrid boss Lopetegui hopeful on Bale availability|
|Mood is positive at Bayern, insists under-pressure Kovac|
|LeBron offers food for thought after losing Lakers debut|
|Bolt future not an immediate concern for Mariners|
|Hazard: I could finish my career at Chelsea|
|Buffon hoping to avoid Champions League final against Juventus|
|Wilshere not ready for West Ham return|
|Chelsea v Manchester United: Hazard better under Sarri than he ever was with Mourinho|
|The big Friday Premier League quiz|
|Khawaja suffers meniscal tear, doubt for India series|
|Babbel: Klopp must win trophies now at Liverpool|
|LeBron makes spectacular start on Lakers debut, but LA fall to Trail Blazers|
|Broncos thrash Cardinals to end losing streak|
|Price leads Red Sox past Astros and into World Series|
|LeBron makes fast start on Lakers debut with two massive dunks|
|Real Salt Lake 4 New England Revolution 1: Hosts boost play-off chances|
|Simmons gets triple-double in win over Bulls|
|´Ambitious´ Maguire wants Champions League football|
|Henry praises ´charismatic leader´ Falcao|
|WATCH: Cardinals WR Fitzgerald tackles former QB Warner on sidelines|
|Spurs right not to make signings – Pochettino|
|Icardi happy at Inter, close to contract renewal|
|This Week in U.S. Sports: Bosa leaves Ohio State while the World Series is almost set|
|Liverpool boost as Salah and Van Dijk join training|
|Cowboys discuss road woes, Prescott says team ´addressed the elephant in the room´|
|Isner scrapes through in Stockholm, Monfils eliminates Tsonga|
|Hinch says Altuve would be out with injury in regular season|
|WATCH: Schwarzenegger tells LeBron to make Lakers great again|
|LeBron tells Lakers coach Walton: I´m always fresh!|
|Mayweather should come back to fight me - Alvarez|
|Goerges battles past Vekic, Kasatkina wins all-Russian tie|
|Ask 32,000 Gibraltarians if the Nations League is meaningless - Styche|
|They´re going to speak about it for years - Azhar reflects on comical run out|
|Garcia in the mix as weather hits Andalucia Valderrama Masters|
|From lacking a ´football brain´ to signing a new contract – the Mourinho-Shaw saga|
|Alonso teases Indy 500 return as Hamilton reveals NASCAR temptation|
|Guptill ruled out of Black Caps´ UAE tour|
|UEFA investigating PSG-Red Star fan clashes|
|Just ´another weekend´ for champion-elect Hamilton|
|G League will offer $125K to top prospects in lieu of NCAA one-and-done route|
|Chargers defensive end Bosa ´a few weeks´ away from return, says father|
|Bale back in full Real Madrid training|
|Roma supporter found not guilty of inflicting GBH on Liverpool fan Sean Cox|
|´Fantastic´ Neuer will prove he´s still the best, says Lloris|
|Perez secures Force India stay|
|Australia wait on Khawaja scan|
|Shaw signs Manchester United extension|
|Jones lays down challenge to snubbed England star Cipriani|
|West Ham´s Pellegrini rejects Dzeko speculation|
|Emery fails to assure Ramsey of Arsenal future|
|Pakistan on course for victory after Babar 99 and farcical run out|
|Canelo ready to leave comfort zone to face Fielding|
|Eriksen ready for Tottenham return, Pochettino confirms|
|Titans coach rocked by Hurrell´s Rhinos switch|
|Rubin Kazan suspended from UEFA competition for FFP breach|
|Real Madrid could sack Lopetegui if results don´t improve, says Essien|
|On-court coaching would add to drama - Mouratoglou|