MADRID — Real Madrid began life without Julen Lopetegui with a comfortable win in the Copa del Rey on Wednesday, when it was Barcelona that struggled to defeat a third-division opponent.

Barcelona needed an injury-time goal to win 1-0 at Cultural Leonesa, while Madrid cruised to a 4-0 victory over third-tier Melilla in a first-leg match in the round of 32.

Interim coach Santiago Solari was on the bench as Madrid won with goals from Karim Benzema, Marco Asensio, Alvaro Odriozola and Cristo Gonzalez in a match played in Spain's small enclave in Africa.

It was Madrid's first game since Lopetegui was sacked on Monday, a day after the team was crushed 5-1 by Barcelona at Camp Nou Stadium for its fifth loss in seven matches in all competitions.

"I'm happy because the team worked hard and showed character," Solari said. "The players showed they are fully committed."

Benzema scored his sixth goal of the season from close range after a low pass by Odriozola in the 28th minute, and Asensio added to the lead with a one-timer from near the penalty spot after a nice set up by youngster Vinicius Junior on the final play of a rainy first half. Vinicius Junior helped set up Odriozola's 79th-minute goal, his first with the club. Odriozola then made the cross for the injury-time goal by Gonzalez, also his first with the main squad.

Benzema was one of the few regular starters on the team, along with captain Sergio Ramos and goalkeeper Keylor Navas. Benzema and Ramos played only the first half, being replaced by Federico Valverde and Nacho Fernandez, respectively.

Solari, who hasn't been ruled out as a permanent replacement for Lopetegui, pleased fans in his debut by including Vinicius Junior in the lineup. Lopetegui had seldom used the 18-year-old Brazilian forward who arrived amid high expectations in the summer but had played mostly in the "B'' squad.

One of the best players in the match, Vinicius Junior nearly scored in the 72nd with a powerful shot that struck the crossbar.

Solari, who had been coaching Madrid's B team, is a former Argentina midfielder who played for Madrid in the early 2000s. He helped the team win the 2002 Champions League, being involved in the play that led to Zinedine Zidane's superb winner in the final.

"We are working as if Solari will be our coach for the rest of the season," Madrid defender Fernandez said. "He knows the club, has experience. We are not the ones making these decisions, so let's see how it goes. But he is a great coach."

Among the other possible candidates to replace Lopetegui are former Chelsea manager Antonio Conte and Belgium manager Roberto Martinez.

BARCELONA SURVIVES

Ousmane Dembele led Barcelona's reserves in a difficult match in northern Spain, and it was his cross from a set piece that led to Clement Lenglet's winning header a minute into stoppage time.

Cultural Leonesa challenged the four-time defending champions throughout the match and had a few good chances to break the deadlock.

"We made some mistakes, but what was important was to win," Lenglet said. "It's was a good away result."

The hosts had midfielder Sergio Marcos sent off with a second yellow card after Barcelona's goal.

OTHER MATCHES

Girona conceded in the 88th but equalized six minutes into injury time to earn a 2-2 draw at Alaves in a match between top-tier teams.

Valladolid, owned by former Brazil striker Ronaldo, cruised to a 2-1 win at second-division club Mallorca, while Getafe netted late to secure a 2-1 victory at Cordoba, another second-tier club.

The return matches in the round of 32 are scheduled for December.

___

More AP soccer: https://apnews.com/apf-Soccer and https://twitter.com/AP_Sports

___

Tales Azzoni on Twitter: http://twitter.com/tazzoni