Luiz Adriano's controversial hat-trick and two goals from Willian, including one sublime finish, helped Mircea Lucescu's side come from behind twice to beat the Danish champions
Luiz Adriano struck a hat-trick, while Willian added two goals for the Ukrainian side, though the former caused controversy after his first goal was very much against the spirit of the game.
Morten Nordstrand and Kasper Lorentzen had given the Danish side the lead, but the defeat sees them exit their debut Champions League campaign at the group stage.
Shakhtar knew that a win would leave them in pole position to qualify for the knock-out stages, and they had a golden chance to take the lead when Henrikh Mkhitaryan blazed over the bar with the goal gaping after Razvan Rat squared from the left.
The home side gradually grew into the match, though, and took advantage of some slack defending when Nordstrand volleyed home from close range after Joshua John curled in a cross from the left.
The Danes were not ahead for long, but the visitors equalised in highly controversial circumstances. Willian punted the ball towards Nordsjaelland's goalkeeper from a drop ball, but Adriano seemed not to understand what was happening and latched onto the ball and rounded the confused Jesper Hansen to score.
Both sides then became embroiled in an argument on the pitch, but the Ukrainian champions failed to allow their hosts to score straight from the restart, despite some apparent instructions from the dugout.
This didn't deter Kasper Hjulmand's team and they regained the lead just moments later as Patrick Mtiliga got forward and fed Lorentzen, who turned and fired past Andriy Pyatov into the roof of the net.
Mircea Lucescu's side needed to get back into the game in more regular circumstances and Mkhitaryan came close close, but he fired wide twice in quick succession.
Shakhtar did get their equaliser on the brink of half-time as Mkhitaryan's shot was blocked by Jores Okore, only for Willian to slot home the rebound, though the final touch may have been Fernandinho's as the ball seemed to brush his back on the way in.
Mkhitaryan was a constant thorn in Nordsjaelland's side and he again went close early in the second half as the visitors counterattacked, but his low shot was turned away by the legs of Hansen.
The hosts couldn't hold the Ukrainians off for long, though, and when a corner wasn't cleared properly, Willian took advantage as he curled in a stunning effort from the edge of the area.
That goal seemed to take the wind out the sails of the Danish champions, and Adriano doubled his tally for the evening as he turned in Alex Teixera's low cross.
Nordsjaelland refused to go down without a fight and almost dragged themselves back into it, but Lorentzen finished woefully as he tried to turn Michael Parkhurst's cross goalwards.
The 26-year-old then had a much easier opportunity as the home side broke forward but the forward miscued his shot and saw it fly over the crossbar after Norstrand's cross took the goalkeeper out of the game.
The match was then put beyond all doubt as Adriano completed his hat-trick by tapping in Douglas Costa's knockdown at the back post inside the final ten minutes.