Dzeko headed in the opener seven minutes before the break in Rome.
The 33-year-old Bosnian international then set up Nicolo Zaniolo for the winner after an hour in the Stadio Olimpico, cancelling out Milan defender Theo Hernandez's equaliser four minutes earlier.
Dzeko underwent surgery after a double fracture to his right cheekbone picked up against Cagliari on October 6.
The former Manchester City and Wolfsburg player also had a small plate with screws inserted in his face.
But despite doctors orders he returned to action immediately wearing a carbon mask because of the team's injury crisis.
"I need to get used to the mask because I can't see very well but mentally I'm fine and that's important," Dzeko said after the midweek Europa League game against Borussia Monchengladbach.