Shakhtar raced into a 3-0 lead after a whirlwind first half with a strike from Brazilian midfielder Tete in the 29th minute, an own goal from Madrid defender Raphael Varane four minutes later and a well-taken effort from Israeli forward Manor Solomon.
Luka Modric pulled one back for Zinedine Zidane's shellshocked side with a brilliant strike from distance early in the second half before substitute Vinicius Jr reduced the deficit to one goal.
La Liga champions Madrid, meanwhile, reflected on a second consecutive home defeat after losing 1-0 at their Alfredo di Stefano stadium to promoted Cadiz on Saturday, further denting their confidence ahead of the 'Clasico' at Barcelona in three days' time.
"In the first half we were not worthy of this competition," said Madrid midfielder Modric.
"It's obvious we need to improve, we lacked confidence today, especially in the first half, but we have to move on, we can't waste any time regretting what has happened."
Shakhtar's Portuguese coach Luis Castro meanwhile had described the numerous positive COVID-19 cases affecting his staff and squad as a "nightmare" but watched on in admiration as his players out-witted and out-ran their more illustrious opponents.
Viktor Korniienko zig-zagged his way through Madrid's defence to lay the ball off for Tete to slot past an outstretched Thibaut Courtois for the opening goal.
Zidane turned to Benzema immediately after the interval and Vinicius soon after and his side finally showed some character and moved to within one goal of levelling the match.
They looked to have found it through Valverde's deflected shot, which trickled into the net but Shakhtar, who had spurned two glorious earlier chances to put the game out of Madrid's reach, were spared.