The 37-year-old, who can become only the second man after Jimmy Connors to take his career title success into three figures, beat the Spaniard 6-3 3-6 6-3 to move into the quarter-finals.
Federer was forced to repel a strong fight-back from his opponent, who failed to convert a break point early in the deciding set before the Swiss star held his nerve to secure victory.
He told “I’m happy that I stayed calm throughout the game.
'This is insane' - Nadal 'so incredible' but 'all about his health' says McEnroe

Roger Federer of Switzerland in action against Fernando Verdasco of Spain during day Eleven of the Dubai Duty Free Tennis Stadium on at Dubai Duty Free Tennis Stadium February 27, 2019 in Dubai, United Arab Emirates

Image credit: Getty Images

“I felt like I was having a good feeling out there. Even though I wasn’t playing my best, I still felt like it was going to fall my way when it really mattered.”
Federer will face Hungary’s Marton Fucsovics next after the world number 35 beat Jan-Lennard Struff of Germany 6-4 6-2.
But top seed Kei Nishikori crashed out after suffering a shock 7-5 5-7 6-2 defeat to Polish qualifier Hubert Hurkacz.
Hurkacz, the world number 77, had never previously beaten a top 10 player but responded superbly in the final set decider, closing out for victory after establishing a 4-1 lead.
The Pole will next face rising Greek star Stefanos Tsitsipas who needed just 57 minutes to overcome Egor Gerasimov of Belarus 6-3 6-1.

Greece's Stefanos Tsitsipas celebrates after winning against Kazakhstan's Mikhail Kukushkin in their men's singles final match at the ATP Open 13 Provence tennis tournament in Marseille, southeastern France, on February 24, 2019.

Image credit: Getty Images

Fresh from his recent tournament win in Rotterdam, Gael Monfils continued his fine form with a 6-3 6-2 win over Marcos Baghdatis, and will next face qualifier Ricardas Berankis, who beat Denis Kudla 6-4 6-1.
Sixth seed Borna Coric recovered from a nightmare first set to beat Tomas Berdych 1-6 6-1 7-6 (4), and Nikoloz Basilashvili was a 6-7 (2) 6-4 6-3 winner over Spain’s Roberto Bautista Agut.
Argentinian third seed Guido Pella had no trouble progressing to the last eight as he won 90 per cent of his first-serve points in a 6-2 6-4 win over Roberto Carballes Baena, while compatriot Marco Trungelliti beat Thiago Seyboth Wild 6-4 7-5.
'Without Federer tennis is almost a different sport' - Zverev
Wilander: Nadal and Djokovic would not be at this level without Federer