Cengiz Under's strike and a string of Alisson saves had kept Roma in the tie in the 2-1 away first-leg defeat, allowing Eusebio Di Francesco's men to edge to victory in the second leg and reach the quarter-finals despite a dismal display in which Dzeko's victor was scarcely deserved.
Roma opened the scoring seven minutes into the second half when Kevin Strootman played Dzeko through on goal with a defence-splitting pass and he made no mistake with just the keeper to beat, 1-0.
The Champions League round of 16 completes on Wednesday, and the draw for the quarterfinal round will take place on Friday, with no restrictions placed on which teams can be paired together.
The two teams went into the interval level, with the visitors looking the more unsafe of the two in the opening stages.
"I was glad to see so many people in the stands cheering us on, suffering together and relishing every moment".
Roma defender Alessandro Florenzi almost netted an own goal in the 11th minute, but he was lucky to witness his miscued clearance sail inches past the upright. "We are among the eight strongest teams in Europe, it means we are strong too".
The opener gave Roma renewed hope and Perotti drew a smart save out of Pyatov with a shot from inside the are on the left 10 minutes into the second half, before Dzeko curled an effort inches wide of the far post from outside the box on 62 minutes after being picked out by Nainggolan.
That gave Roma confidence and it nearly doubled its lead 10 minutes later but Dzeko fired narrowly wide. "We managed to do something Roma hadn't in 10 years, so going forward to play against the best makes us all very proud".
Ordets was shown a red card for tugging on Dzeko's shirt before a scuffle broke out on the pitch after two Shakhtar players pushed a ballboy over the advertising boards for holding on to the ball.
Dzeko was given a standing ovation when he was substituted in the final minute.