Inter levelled 11 minutes later through Dzeko after Lautaro Martinez nodded the ball into the six-yard box for the Bosnia striker to finish with a clever backheel.
Simone Inzaghi's visitors took the lead when Dzeko's strike from close range deflected off Atalanta defender Joakim Maehle into the net after 56 minutes.
Inter went 3-1 up just after the hour when home defender Jose Luis Palomino headed the ball into his own net after Martinez nodded on a corner from Hakan Calhanoglu.
Palomino made amends in the 77th when he cut the deficit with a diving header from a corner.
Atalanta remain sixth on 27 points.