Los Blancos beat Al Ahly in the semi-finals to advance to Saturday's showpiece event, while Al-Hilal navigated their way past Brazilian giants Flamengo in the final four.
Vinicius Junior and Federico Valverde both netted twice for Carlo Ancelotti's side, while Karim Benzema was also on the scoresheet for the Champions League holders.
Real Madrid's last success in the competition had been in 2018, but they have now won the 2022 edition of the tournament, moving them two clear of Barcelona in terms of Club World Cup trophies.
Having made the trip out to Morocco due to his fast recovery from a slight hamstring issue, Benzema was named in the starting XI for Real Madrid, and it came as no surprise when the Frenchman was involved in his side's first of the match.
Indeed, Benzema combined with Valverde in a deep position before sliding a pass into Vinicius, who managed to squeeze the ball under the onrushing goalkeeper to send Los Blancos into a 13th-minute lead.
Al-Hilal came close to a leveller in the 15th minute when Mohamed Kanno found space in a dangerous area before finding Luciano Vietto, but the striker's low effort was just wide of the post.
The Saudi Arabian side were made to pay for the missed chance, as they conceded a second in the 19th minute, with Valverde scoring his 10th goal of the campaign.
It was an untidy goal from Al-Hilal's point of view, as a low Luka Modric cross eventually broke for Valverde, who managed to find the back of the net with a volley despite there being three Al-Hilal defenders between himself and the goalkeeper when he struck the ball.
Ramon Diaz's side did manage to halve the deficit in the 26th minute, though, with Kanno delivering a pass into Moussa Marega, who broke into the Real Madrid box before firing past Andriy Lunin, with the power on the strike enough to beat the Spanish club's number two goalkeeper.
Real Madrid had a chance to score a third shortly before the interval when Valverde picked out Benzema, but the striker flicked his effort wide of the post from close range.
Benzema finally had his goal in the 54th minute, with the centre-forward firing a cross from Vinicius into the back of the net from close range.
Real Madrid then took the match away from Al-Hilal in the 58th minute, with Valverde scoring his second from inside the box after meeting a low cross from Dani Carvajal.
Vietto scored a second for Al-Hilal in the 63rd minute, finding the bottom corner with a clever finish, but Real Madrid had their fifth in the 69th minute, with Vinicius curling one into the far corner after good work from Dani Ceballos.
An incredible match was not finished, though, and Vietto netted his second in the 79th minute, with the Argentine brilliantly turning inside the Real Madrid box before finding the back of the net after smart work down the left from Michael.
Al-Hilal should have had a fourth in the 81st minute with Michael picking out Marega, but the forward fired wide, with Los Blancos ultimately running out 5-3 winners.
Real Madrid will be back in La Liga action at home to basement side Elche on Wednesday night, while Al-Hilal will resume their domestic campaign against El Feiha on the same day.