Having picked up just one point from their previous three outings, the visitors were in need of a morale-booster heading into Tuesday's game. Meanwhile, the hosts came into the game fresh off the back of an emphatic 6-1 victory over Zorya in the Ukrainian League.
Serhiy Kryvtsov scored a 37th-minute own goal to give Real Madrid a 1-0 lead in the first half. The floodgates were then opened after the interval as Los Blancos scored four goals to cap off a superb team performance. Vinicius Junior (2), Rodrygo and Karim Benzema were on the scoresheet for the Spanish giants.
Next up for Real Madrid is a highly-anticipated El Clasico clash against Barcelona on Sunday. Meanwhile, Shakhtar Donetsk travel to the Butovsky Vorskla Stadium to face Vorskla Poltava in the Ukrainian League on Saturday.
Real Madrid player ratings against Shakhtar Donetsk
Thibaut Courtois - 7/10
The Real Madrid shot-stopper did little in the first half as the hosts posed no threat in attack. However, he was forced into making several vital stops after the break and did brilliantly whenever called upon.
Lucas Vazquez - 7/10
The Real Madrid academy graduate put in a solid display on the right side of the defense. He was solid at the back and going forward.
Vazquez played a major role in the opening goal. It was his cross that Serhiy Kryvtsov sent into his own net.
Eder Militao - 7.5/10
Playing at the heart of the defense, the Brazilian defender put on a dominating performance. He was on deck to repel the Shakhtar Donetsk attack and finished the game with two clearances, three interceptions and two tackles. He also won four ground duels.
David Alaba - 7/10
The former Bayern Munich defender played a huge role in Real Madrid's build-up play as he often started the move from the back. He finished the game with an almost perfect passing accuracy, completing almost 98% of his attempted passes.
Ferland Mendy - 7.5/10
The French defender made his return from a five-month spell on the injury table. He got off to a flyer as he put in a colossal performance down the right flank. He marauded forward in his usual manner and showed no signs of fatigue or poor fitness.
Luka Modric - 7.5/10
Luka Modric struggled to match the pace of the game occasionally but did well in distributing the ball whenever needed.
The Real Madrid veteran created two big chances in the game. He finished with one assist and completed all his long-ball attempts.
Casemiro - 7/10
This was a routine performance from Real Madrid's star midfielder. Casemiro did the dirty job in midfield, winning three tackles and four duels as he provided a shield high up the pitch for his backline.
Toni Kroos - 6.5/10
Toni Kroos struggled to get going at the center of the park for Real Madrid but gradually grew into the game. He kept the play going brilliantly and contributed defensively by winning several key tackles and duels.
The German was substituted for Federico Valverde in the 78th minute.
Rodrygo - 7.5/10
Rodrigo was a massive threat to Shakhtar Donetsk as he took on his marker at any given opportunity on the right flank. The youngster got on the scoresheet in the 65th minute, netting the fourth goal of the game and his second of the campaign.
Vinicius Jr - 9/10
Vinicius Junior put in a stellar performance for Real Madrid. He scored two goals in a five-minute spell (51st minute and 56th minute) before capping off a dominating performance with an assist for Rodrygo in the 65th minute.
Karim Benzema - 9/10
Karim Benzema simply cannot stop scoring at the moment. His link-up play and work rate were exquisite on Tuesday. He linked up well with his teammates and grabbed an assist before putting the icing on the cake with Real Madrid's fifth and final goal in the 91st minute.
Player ratings for Real Madrid substitutes
Marcelo - 6/10
The Real Madrid veteran came on for Ferland Mendy with 20 minutes to go and had a decent outing. He occasionally got deep into the hosts' half but often lacked the end product to make something happen.
Marco Asensio - 6.5/10
Marco Asensio came on in the 78th minute for Rodrygo and did well to grab an assist for Karim Benzema's strike. Overall, the Spaniard put in a fine off-the-bench performance.
Eduardo Camavinga - 6.5/10
The newly-signed Real Madrid midfielder replaced Luka Modric in the 77th minute and injected fresh life into the game. In his short spell, he won two duels, one tackle and made one clearance.
Federico Valverde - 5.5/10
Federico Valverde replaced Toni Kroos with 12 minutes remaining on the clock and made no telling contribution.
Jesus Vallejo - N/A
The 24-year-old came on with three minutes left to play and did not do enough to warrant a rating.