Lamine Yamal, Robert Lewandowski, Raphinha and Alejandro Balde were all on target before halftime, after French forward Kylian Mbappe put Real in front in the fifth minute. Raphinha grabbed another in the second half while Rodrygo scored for Real.
Kylian Mbappe put Madrid ahead but a dominant Barcelona hit five in response before their goalkeeper Wojciech Szczesny was sent off in the second half.
LaLiga leaders Real recovered from that setback and are on a five-match winning streak ahead of defending the Super Cup in Jeddah, Saudi Arabia, but coach Carlo Ancelotti is cautious.
Last season, around this time, there was a surprise package in Girona in the top three of LaLiga. However, a year later, the Spanish league has returned to the status quo, with Real Madrid, Barcelona, and Atletico Madrid -- the three giants of Spain -- occupying the top three spots on the table at the end of 2024.
Jude Bellingham and Rodrygo scored second-half goals to help Real to a 3-0 win over Mallorca after Barcelona beat Athletic Bilbao 2-0 in the other last-four clash.
"Our player Luka Modric is out of the game against Mallorca today because of a viral illness," said the Spanish champions in a statement.
The Brazilian winger was dismissed in Madrid's 2-1 victory on Friday for pushing Valencia goalkeeper Stole Dimitrievski in the back of the neck.
"(Luka) is a gift for football and even more for those who can enjoy it up close," Madrid coach Carlo Ancelotti said. "The fans, the players, the coach... for me it's a great gift. The way he prepares for this kind of match, as if it was a final. It's a very important example for our youngsters.
Real Madrid coach Carlo Ancelotti said Sunday it would be "difficult" to be Vinicius Junior after the player was sent off against Valencia.
With an expected attendance of 85,000, the stadium will be packed to the rafters for Mbappe's first appearance before fans in what should beat the record set 15 years ago by Cristiano Ronaldo.
Endrick has revealed that his father wanted to name him after a Real Madrid icon - but that his mother blocked it.
Mbappe, who will wear the number 9 shirt, will be presented at the Bernabeu at midday (1000 GMT) on Tuesday and will be welcomed by Real president Florentino Perez for the signing of his five-year contract, the club announced on Wednesday.
Real Madrid confirmed the sale of Spain striker Joselu to Qatari side Al-Gharafa on Friday after buying him from Espanyol by activating a clause in his loan deal.
Brazil's poor performance in their goalless draw against Costa Rica in their Copa America opener on Monday has dampened the enthusiasm surrounding their new manager and a revamped squad headlined by Vinicius Jr.
Club captain Nacho Fernandez will leave Real Madrid for a reported move to Saudi Arabia, the 15-time Champions League winners announced on Tuesday.
France captain Mbappe could then play his first home game for the holders against Real Valladolid a week later.
"For the Olympics my club has a position which is very clear so that means I think I will not participate in the Olympics. That is how it is," Mbappe said.
"This first criminal conviction in Spanish history is not for me. It's for all black people," the Real Madrid and Brazil attacker posted on social media.
"In my interview with Il Giornale, my words about the FIFA Club World Cup have not been interpreted in the way I intended," Ancelotti posted on X.