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 such an attack-minded team you can never avoid this," Hummels said.
Darijo Srna put Shakhtar ahead with a 31st-minute free kick but Dortmund deservedly scored through Robert Lewandowski just 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.