A magnificent finish by Bosnia striker Edin Dzeko sent the Italian side through on away goals in spite of a 2-2 ending.
Roma celebrated only their second win in six meetings with the Ukrainian side and got revenge for a 6-2 aggregate defeat at the same stage of the competition in 2011.
They endured a nervy finish, however, as Shakhtar ended the match on the front foot in spite of playing the final few minutes with 10 men after Ivan Ordets was red-carded.
Having trailed 2-1 from the first leg, Roma looked bereft of ideas for much of the contest at the Stadio Olimpico before Dzeko broke the deadlock in the 52nd minute.
This was after a tepid first half devoid of goal-mouth action.
The Bosnian took a defence-splitting pass from midfielder Kevin Strootman into his stride and beat the offside trap.
He then steered the ball into the far corner with the outside of his foot past advancing goalkeeper Andriy Pyatov.
The former Manchester City striker has been linked with a move back to the English Premier League, but said after the match that he did not want to leave Roma.
He was given a rousing send-off by the home fans when he was substituted in the dying minutes.
“Everyone deserves a standing ovation because we all gave absolutely everything tonight and we fully deserve to be in the quarter-finals,” Dzeko said.
“We achieved something that’s been missing for 10 years and are now prepared to face anyone in the last eight. All the other teams are strong but we are strong too.”
Shakhtar came close to extending their overall advantage in the 13th minute.
This was when Roma defender Alessandro Florenzi headed a floated free kick into the box inches wide of his own far post.
Roma’s solitary glimpse of goal in the opening half came in the 28th minute.
Visiting goalkeeper Pyatov palmed away a fizzing low cross by Aleksandar Kolarov to deny Dzeko a simple tap-in from close range.
The home side came out with renewed purpose in the second half and Dzeko delighted their vocal fans when he broke the deadlock with a trademark clinical finish.
Dzeko also curled a shot from the edge of the penalty area inches wide in the 62nd minute.
Thereafter, Shakhtar centre-back Ordets was shown a straight red card in the 79th for hauling down the Bosnian when he was through on goal.
In spite of being a man down, Shakhtar launched a late onslaught and had several dangerous raids down the left flank but the home team’s defence held on until the final whistle.
Roma’s former captain Francesco Totti, who watched anxiously from the terraces, was overjoyed at full-time.
“A fantastic result, a fantastic Roma,” he said on the club’s official twitter account. “Among the eight best sides in Europe and we push onto the next round.”