Barcelona’s losing run against Real Madrid is finally over as the Catalan club enjoyed a stunning 4-0 win Sunday and showed its title hopes in the Spanish league maybe aren’t finished just yet.

Barcelona kept its good momentum under coach Xavi Hernández in the last “clásico” of the season, ending a five-match losing streak to its rival and maintaining an outside chance of fighting for the title after a difficult start to its first season without Lionel Messi.

More Images
Barcelona's Ronald Araujo, left, celebrates after scoring his side's second goal during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona’s losing run against Real Madrid is finally over as the Catalan club enjoyed a stunning 4-0 win Sunday and showed its title hopes in the Spanish league maybe aren’t finished just yet.

Barcelona's Pierre-Emerick Aubameyang, right, celebrates after scoring his side's opening goal during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

It was Pierre-Emerick Aubameyang who thrived this time, scoring twice to continue his great streak since being signed in the final minutes of the winter transfer window. Ronald Araujo and Ferran Torres added a goal each to give Barcelona its seventh win in the last eight matches in all competitions.

Real Madrid's Vinicius Junior gestures as Barcelona players celebrates their first goal by their teammate Pierre-Emerick Aubameyang during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Madrid, which badly missed the injured Karim Benzema, was unbeaten in its last eight games in the league, with six wins. It had beaten its Catalan rival 2-1 at Camp Nou in their first league game last year.

Real Madrid's Vinicius Junior, right, argues with Barcelona's Gerard Pique during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

He opened the scoring with a close-range header after a cross by Ousmane Dembélé in the 29th minute, and sealed the victory with a nice flick over goalkeeper Thibaut Courtois in a breakaway in the 51st.

In this photo taken with slow shutter speed, Real Madrid's Rodrygo, left, runs with the ball past Barcelona's Pedri, center, and Barcelona's Jordi Alba during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Benzema, the league’s top scorer with 22 goals, couldn't play because of a left-leg injury sustained in the league match against Mallorca, when he scored for the eighth time in five games in all competitions. The French striker had netted a hat trick in Madrid’s thrilling comeback win against Paris Saint-Germain last week in the Champions League at the Bernabéu.

Barcelona's Frenkie de Jong, right, fights for the ball with Real Madrid's Toni Kroos during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona has also secured a place in the quarterfinals of the Europa League.

Real Madrid's Federico Valverde reacts after a missed scoring opportunity during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Villarreal stayed three points behind Betis after a 1-0 loss at Cádiz, which is just outside the relegation zone. Mallorca stayed a point behind Cádiz after losing 1-0 at Espanyol for its sixth consecutive defeat.

Barcelona's head coach Xavi Hernandez attends a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's head coach Xavi Hernandez attends a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's Frenkie de Jong, right, fights for the ball with Real Madrid's Toni Kroos during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's Frenkie de Jong, right, fights for the ball with Real Madrid's Toni Kroos during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

The victory — its first against Madrid since 2019 — came in style, like a few others it got at the Santiago Bernabéu Stadium with Messi in his prime.

Barcelona's Ronald Araujo, left, celebrates after scoring his side's second goal during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's Ronald Araujo, left, celebrates after scoring his side's second goal during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

It was Pierre-Emerick Aubameyang who thrived this time, scoring twice to continue his great streak since being signed in the final minutes of the winter transfer window. Ronald Araujo and Ferran Torres added a goal each to give Barcelona its seventh win in the last eight matches in all competitions.

The result moved Barcelona within 12 points of league leader Madrid with nine rounds to go, and it could further cut the gap to nine points if it wins its game in hand against Rayo Vallecano.

Barcelona is level on points with fourth-place Atlético Madrid and is three points behind second-place Sevilla, which was held 0-0 at home against Real Sociedad earlier Sunday for its third straight draw in the league.

Barcelona's Pierre-Emerick Aubameyang, right, celebrates after scoring his side's opening goal during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's Pierre-Emerick Aubameyang, right, celebrates after scoring his side's opening goal during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Madrid, which badly missed the injured Karim Benzema, was unbeaten in its last eight games in the league, with six wins. It had beaten its Catalan rival 2-1 at Camp Nou in their first league game last year.

Barcelona has been revitalized by Xavi and its attack has been red hot, outscoring opponents 24-5 in its last eight matches, with Aubameyang and Torres combining for 15 goals since arriving at the club this year.

Aubameyang has now scored nine goals in his 11 appearances since arriving from Arsenal.

Real Madrid's Vinicius Junior gestures as Barcelona players celebrates their first goal by their teammate Pierre-Emerick Aubameyang during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Real Madrid's Vinicius Junior gestures as Barcelona players celebrates their first goal by their teammate Pierre-Emerick Aubameyang during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

He opened the scoring with a close-range header after a cross by Ousmane Dembélé in the 29th minute, and sealed the victory with a nice flick over goalkeeper Thibaut Courtois in a breakaway in the 51st.

Araujo had added to the lead with a header off a corner kick in the 38th before Torres scored the third in the 47th after a clever flick-pass by Aubameyang as the Madrid defense collapsed yet again.

Barcelona had several other significant scoring opportunities throughout the match, with Aubameyang, Torres and Dembélé among those missing good chances.

Real Madrid's Vinicius Junior, right, argues with Barcelona's Gerard Pique during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Real Madrid's Vinicius Junior, right, argues with Barcelona's Gerard Pique during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Benzema, the league’s top scorer with 22 goals, couldn't play because of a left-leg injury sustained in the league match against Mallorca, when he scored for the eighth time in five games in all competitions. The French striker had netted a hat trick in Madrid’s thrilling comeback win against Paris Saint-Germain last week in the Champions League at the Bernabéu.

Madrid coach Carlo Ancelotti did not replace Benzema with another striker, instead using Luka Modric in a false-nine position at the top of the attacking line along with Vinícius Júnior and Rodrygo. Madrid barely threatened, though, and Ancelotti had to change tactics in the second half by putting Mariano Díaz up front, which also didn't help much.

Ancelotti also couldn’t count on injured left back Ferland Mendy, with Nacho Fernández replacing him instead of veteran Marcelo.

In this photo taken with slow shutter speed, Real Madrid's Rodrygo, left, runs with the ball past Barcelona's Pedri, center, and Barcelona's Jordi Alba during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

In this photo taken with slow shutter speed, Real Madrid's Rodrygo, left, runs with the ball past Barcelona's Pedri, center, and Barcelona's Jordi Alba during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona has also secured a place in the quarterfinals of the Europa League.

It hosts Sevilla in the league after the international break, while Madrid visits midtable Celta Vigo.

OTHER RESULTS

Fifth-place Real Betis missed a chance to gain some ground after being held to a 0-0 draw at Celta. Manual Pellegrini’s team stayed four points behind Barcelona and Atlético, and two points ahead of Real Sociedad in a tight fight for the Champions League places.

Barcelona's Frenkie de Jong, right, fights for the ball with Real Madrid's Toni Kroos during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's Frenkie de Jong, right, fights for the ball with Real Madrid's Toni Kroos during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Villarreal stayed three points behind Betis after a 1-0 loss at Cádiz, which is just outside the relegation zone. Mallorca stayed a point behind Cádiz after losing 1-0 at Espanyol for its sixth consecutive defeat.

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP_Sports

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

Real Madrid's Federico Valverde reacts after a missed scoring opportunity during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Real Madrid's Federico Valverde reacts after a missed scoring opportunity during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's head coach Xavi Hernandez attends a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's head coach Xavi Hernandez attends a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's Frenkie de Jong, right, fights for the ball with Real Madrid's Toni Kroos during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)

Barcelona's Frenkie de Jong, right, fights for the ball with Real Madrid's Toni Kroos during a Spanish La Liga soccer match between Rial Madrid and FC Barcelona at the Santiago Bernabeu stadium in Madrid, Spain, Sunday, March 20, 2022. (AP PhotoManu Fernandez)