Federer defeated Roberto Bautista Agut of Spain 6-3, 2-6, 6-4, a day after being taken the distance by Daniil Medvedev of Russian Federation.
The 14-time Grand Slam champion missed six months of competition in 2017 and had elbow surgery at the start of this year.
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.
In what was the first meeting between the pair, Federer broke in the ninth game to finally destroy Medvedev's resolve in just under two hours.
The former world number one and 37-year-old Swiss superstar advanced but Medvedev produced the highlight of the night in the second set.More news: Eden Hazard Dwells On 'Regretful' Role In Jose Mourinho's Chelsea-Exit
Fifth seed Cilic soon followed the Austrian in making an early exit, letting a comfortable lead slip in a 2-6 7-6 (8-6) 7-5 loss to compound his misery after a similar collapse at the Japan Open.
"I wanted to start off well because I know that he battles hard and he makes you deserve every point, win every point".
"I haven't followed his season super-closely to be honest because I check in and out of the tour too often. But I'm going like hour by hour and see how I'm feeling". "I wasn't, I feel like, playing as well as I'm playing today".
Fourth seed Alexander Zverev also barrelled into the quarters with a 6-1, 6-4 victory over Alex de Minaur.
The Frenchman saved the first match point with a brilliant serve and volley but after he failed to force a tie-break, a long forehand gave Djokovic passage to the second round, where he will meet Marco Cecchinato or Hyeon Chung.
Federer, who himself acted as a ball boy in his youth, said he felt most of the young helpers understood the pressure players are under, but that it was vital they enjoyed a good experience at tournaments.
Djokovic will play South Africa's seventh seed Kevin Anderson and said he was arrowing in on Rafael Nadal's top ranking.
ERROR: Macro /ads/dfp-ad-article-new is missing!