Mats Hummels headed in an 87th-minute corner after substitute Douglas Costa thought he had won it for the hosts in the 68th minute to leave the Germans as favourites ahead of the second leg in Dortmund on March 5.
"It is important that we are going into the second leg level and a 0-0 would see us through. Certainly there were a few dangerous moments in defence, but against a such an attack-minded team you can never avoid this," Hummels told reporters.
Darijo Srna put Shakhtar ahead with a 31st-minute free-kick but Dortmund deservedly scored through Robert Lewandowski four minutes before the break.
The match went ahead despite at least five people being killed when a plane carrying supporters to the match in eastern Ukraine overshot the Donetsk runway and broke up as it attempted an emergency landing in the fog hours before kick-off.
A minute's silence was held inside the Donbass Arena by players and fans before the match.
Dortmund dominated early on with several half chances but Felipe Santana then committed a needless foul and Srna's dipping effort went in past goalkeeper Roman Weidenfeller who could have done better.
The visitors, who also hit the bar through Hummels, levelled when Poland's Lewandowski completely miskicked in the box but the ball fell kindly for the striker and he coolly slotted home.
Shakhtar, slightly rusty with their domestic season on a mid-season break and with Luiz Adriano back after his infamous unsporting conduct ban, only came close again in the first half through Alex Teixeira after another Weidenfeller misjudgement.
The second period was more even and Brazilian Douglas Costa scored six minutes after coming on when he controlled a long ball over the top and swivelled to bury a fine shot into the corner of the net amid lax Dortmund defending.
The 1997 Champions League winners had the last laugh though when Germany defender Hummels rose unmarked to power in a header.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.