Napoli's defeat on Wednesday night, which also ended their 11-match domestic winning streak, enabled second-placed AC Milan to narrow the gap at the top to five points following their 2-1 win at Salernitana.
Napoli struggled for rhythm on their return after the seven-week World Cup and festive break, and Dzeko's 56th-minute effort, when he got on the end of a cross from Federico Dimarco at close range, proved enough.
The visitors laid siege to the Inter goal in the dying stages with substitute Giacomo Raspadori seeing a late low effort saved by Andre Onana.
"It's a big achievement beating Napoli," Inter coach Simone Inzaghi said. "It should give us a huge amount of motivation."
The only other time Napoli lost this season was against Liverpool in the Champions League on November 1 - a result that still enabled the Partenopei to win their group.
Napoli coach Luciano Spalletti bemoaned a drop off: "We weren't able to move the ball around with the same quality as usual," he said. "Several players weren't up to form."
Goals from Rafael Leao and Sandro Tonali put Milan in full control at Salernitana before a late strike from Federico Bonazzoli caused some anxious moments for Stefano Pioli's side.
Juventus continued to press the top two but they left it late to claim their seventh straight win at Cremonese, with Arkadiusz Milik rifling home the only goal of the game from a stoppage time free-kick.
Cremonese, still without a win this season, had an early strike from Emanuele Valeri disallowed by VAR, and Cyriel Dessers hit the post in the second half.
Lazio lost more ground as they were shocked 2-1 at Lecce despite Ciro Immobile's early effort. Gabriel Strefezza equalised just before the hour mark and Lorenzo Colombo fired a 71st-minute winner for the hosts.
Lorenzo Pellegrini's sixth-minute penalty proved enough for Roma to edge out Bologna, but they were grateful to Tammy Abraham who made a last minute goal-line clearance to deny Jhon Lucumi an equaliser.
― With AAP.