Turkish youngster Cengiz Under marked his Champions League debut for Roma with a well-taken 41st-minute opener.
But second-half strikes from Facundo Ferreyra and Fred left the tie finely balanced ahead of the return game at the Stadio Olimpico in three weeks’ time.
“My team has everything they needed to play 90 minutes at a high level so the mistakes we’ve made were mental,” Roma manager Eusebio Di Francesco said.
“I told the team to play the second half the way we played the first, but what I’ve seen on the pitch is that the team were happy to defend. We need to work on that problem.”
Roma, looking to reach the quarter-finals for the first time in 10 years, started brightly while Shakhtar, who only returned to competitive action last weekend after the winter break, left the visitors too much space in midfield.
The Italians had a chance to go ahead in the sixth minute, but goalkeeper Andriy Pyatov saved well to deny Edin Dzeko.
In the 21st minute, Dzeko forced Pyatov into another diving save with a low shot from the edge of the area after a quick counter-attack.
But the keeper was unable to prevent Under from putting Roma ahead four minutes before half-time.
The 20-year-old forward latched onto a clever through ball from Bosnian striker Dzeko and sent the ball into the net despite the best efforts of Pyatov.
Under has been a revelation in recent weeks for Roma and has now scored five goals in his last four appearances.
But after the interval Shakhtar, who had won three of their four previous meetings with Roma in the Champions League, moved up a gear.
A long ball forward by full-back Yaroslav Rakitskiy picked out Ferreyra, who dribbled into the box to slip the ball under the onrushing Alisson Becker.
The hosts continued to cut apart the Roma defence, but Brazil keeper Alisson was on top form as he palmed away a shot from Marlos, before springing to his left to brilliantly claw behind Taison’s long-range effort.
But Fred put Shakhtar into the lead with a magnificent free-kick with 19 minutes to play.
His powerful left-footed shot from 20 yards out dipped viciously and flew into the back of the net off the underside of the crossbar for his first Champions League goal.
It could have been even better for Shakhtar as they bid for a first appearance in the last eight since 2011, but Roma substitute Bruno Peres made an extraordinary goalline block while lying on the ground to deny Ferreyra in the final minute of injury-time.
Shakhtar head coach Paulo Fonseca said. “The only reason we didn’t win by a bigger margin was a brilliant display from the Roma keeper.”
Would you like to place a soccer bet? Click here to get started in 3 easy steps.