Djokovic was never in danger in his 6-3, 6-4 triumph over 53rd-ranked Spaniard Pablo Carreno Busta, whom he finished off in 90 minutes.
Federer fell in a first-time meeting with Russian Andrey Rublev, who posted a 6-3, 6-4 upset.
Defending champion Djokovic will continue his quest in a Friday quarter-final, taking on France's Lucas Pouille, a 6-7 (3/7), 6-4, 6-2 winner over Russian Karen Khachanov.
Djokovic earned his eighth straight victory at Cincinnati on the first of two match points.
"I'm very pleased today. I beat a top quality player," Djokovic said. "It was straight sets but the score doesn't indicate how tough it was.
"He had break points in both sets and I got out of trouble with some good serves. Overall, it was a really good match."
Federer, the seven-time Cincinnati champion who turned 38 last week, was unable to make an impression on Rublev, playing only his second match since losing the Wimbledon final to Djokovic.
"I struggled on my serve early on. Got broken the first service games, and there you have it," Federer said. "That sort of set the tone for the match maybe a little bit.
"But the combination was tough: he was playing well. I was maybe struggling especially on the offensive. I didn't think I was feeling the ball badly, but sometimes can't rely on that serve to the one-two punch."
Rublev, a 21-year-old Russian qualifier who missed months last season with injury, was shell-shocked at his win over the 20-time Grand Slam champion.
"It's an amazing feeling when you play such a legend as Roger," he said. "At least 99 percent of the crowd was supporting him.
"Today I was just trying to do my best. I told myself I need to play every point to the end. No matter what the situation, I kept fighting."
Swiss third seed Federer went down to the world number 70 in barely an hour, losing for only the 10th time here after winning 47 matches.
"He was super clean," Federer said. "Defense, offense, serving well. Didn't give me anything. He was everywhere. So it was tough for me, but excellent match by him. I was impressed."
Rublev earned his second top-five win in a month after beating Dominic Thiem in Hamburg on his way to the final.
Barty eyes No 1 return
Women's top seed Ashleigh Barty held off Anett Kontaveit as the Estonian served for victory before the top seed scraped a 4-6, 7-5, 7-5 triumph into the WTA event quarter-finals.
The win keeps the Australian in the chase for a possible return to the WTA number one ranking, which she lost to Naomi Osaka on Monday. Barty needs to reach Sunday's final in order to regain the ranking summit.
"It was a little bit scrappy at times today but proud of the way we were able to fight and hang in there right until the end," said the reigning Roland Garros champion.
"It was more about the fight today than the tennis."
Barty, who earlier eliminated five-time Grand Slam winner Maria Sharapova, will play Friday against Maria Sakkari of Greece, a 6-7 (4/7), 6-4, 6-4 winner over ninth seed Aryna Sabalenka.
Japanese second seed Osaka advanced 7-6 (7/3), 5-7, 6-2 over Hsieh Su-Wei, who defeated Osaka this year in Miami.
Osaka, current holder of the US and Australian Open titles, is playing the event for the fist time after failing to qualify on her only previous attempt in 2016.
2017 US Open finalist Madison Keys sent Wimbledon champion Simona Halep out 6-1, 3-6, 7-5.
Halep, last year's Cincinnati runner-up, will go to the US Open with just three post-Wimbledon competitive matches.
Double Grand Slam champion Svetlana Kuznetsova beat 2017 US Open winner Sloane Stephens 6-1, 6-2.
Venus Williams won three matches in a row for the first time since March as she defeated Donna Vekic 2-6, 6-3, 6-3.
Results on Thursday at the WTA/ATP Cincinnati Masters (x-denotes seeding):
Novak Djokovic (SRB x1) bt Pablo Carreño-Busta (ESP) 6-3, 6-4
Lucas Pouille (FRA) bt Karen Khachanov (RUS x8) 6-7 (3/7), 6-4, 6-2
Andrey Rublev (RUS) bt Roger Federer (SUI x3) 6-3, 6-4
Daniil Medvedev (RUS x9) bt Jan-Lennard Struff (GER) 6-2, 6-1
Roberto Bautista Agut (ESP x11) bt Miomir Kecmanovic (SRB) 6-1, 6-2
Richard Gasquet (FRA) bt Diego Schwartzman (ARG) 7-6 (8/6), 6-3
Yoshihito Nishioka (JPN) bt Alex De Minaur (AUS) 7-5, 6-4
David Goffin (BEL x16) bt Adrian Mannarino (FRA) 7-6 (8/6), 6-2
Ashleigh Barty (AUS x1) bt Anett Kontaveit (EST) 4-6, 7-5, 7-5
Maria Sakkari (GRE) bt Aryna Sabalenka (BLR x9) 6-7 (4/7), 6-4, 6-4
Karolína Plíšková (CZE x3) bt Rebecca Peterson (SWE) 7-5, 6-4
Svetlana Kuznetsova (RUS) bt Sloane Stephens (USA x8) 6-1, 6-2
Venus Williams (USA) bt Donna Vekic (CRO) 2-6, 6-3, 6-3
Naomi Osaka (JPN x2) bt Hsieh Su-wei (TPE) 7-6 (7/3), 5-7, 6-2
Madison Keys (USA x16) bt Simona Halep (ROM x4) 6-1, 3-6, 7-5
Sofia Kenin (USA) bt Elina Svitolina (UKR x7) 6-3, 7-6 (7/3)