The former Manchester City striker netted a brace at San Siro as the Nerazzurri moved to the brink of the last 16.
Dzeko opened the scoring with a clinical finish in the 61st minute, before sealing the win six minutes later with a close-range header.
Simone Inzaghi's side move to the summit of Group D and will secure a top-two finish if Real Madrid beats Sheriff Tiraspol later on Thursday (AEDT).
Inter asked Shakhtar plenty of questions during the first half with 14 shots on goal.
The visitor had Anatolii Trubin to thank as the goalkeeper made strong blocks to deny Lautaro Martinez and Dzeko, while Andrea Ranocchia headed a decent opportunity wide from a corner.
Inter thought they had taken the lead when Ivan Perisic drilled home in the 24th minute, but the effort was ruled out after Hakan Calhanoglu strayed offside.
Chances for Shakhtar were few and far between at the other end, although Samir Handanovic was called into action to deny Fernando following a strong run.
Inter had the ball in the net again 12 minutes after the restart, Martinez volleying past Trubin, only for his strike to be ruled out for a push.
But there was no denying the hosts four minutes later as Dzeko fired home from just inside the box after Matteo Darmian's initial effort ricocheted kindly into his path.
The Bosnia-Herzegovina international doubled his tally within six minutes, popping up at the far post to head home Perisic's inviting cross and secure the points.