Wednesday's Group B clash seemed to be set up for a straightforward Madrid win, with Shakhtar clear underdogs even before losing half their squad to COVID-19 in a situation coach Luis Castro described as "a nightmare".
But Zinedine Zidane's LaLiga champions were outthought and outfought for 45 minutes at their temporary Estadio Alfredo Di Stefano home as strikes from Mateus Tete and Manor Solomon sandwiched a Raphael Varane own goal to secure a three-goal half-time lead.
Madrid also lost at home to Cadiz last Saturday and visit bitter rivals Barcelona in the Clasico this weekend yet at least showed some fight after the break.