MADRID (AP)Barcelona needed only seven minutes to get back on track in the Spanish league.

After losing to Real Madrid in the ”clasico” on Sunday, Barcelona rebounded by scoring three goals in a seven-minute span in the first half of a 3-0 win over Villarreal on Thursday.

Robert Lewandowski scored in the 31st and 35th minutes, and Ansu Fati added one in the 38th to give Barcelona the victory and move the Catalan club back within three points of defending champion Madrid.

Madrid had taken its lead to six points after a 3-0 win at last-place Elche on Wednesday. The rivals had entered the first ”clasico” of the season tied on points and Madrid won 3-1 at the Bernabeu to take sole possession of first place.

Sunday’s loss had compounded Barcelona’s disappointment after it saw its hopes of advancing in the Champions League all but end with a 3-3 home draw against Inter Milan last week.

”After the bad results against Inter and Madrid we needed a victory,” Barcelona midfielder Frenkie de Jong said. ”Winning always helps to boost the team’s morale in the locker room.”

Coach Xavi Hernandez said Barcelona had to quickly change its dynamics, and the squad responded.

Lewandowski opened the scoring with a low shot from near the penalty spot after clearing two defenders with a nice first touch off a cross by Jordi Alba.

The Poland striker added to the lead with another beautiful goal as he moved away from a defender and a fired a curling right-footed shot from outside the area into the far corner.

Fati sealed the victory from close range after a buildup started by Ferran Torres. It was Fati’s first goal since September.

It was Barcelona’s eighth win in 10 league matches so far, with the other setback in addition to the ”clasico” loss being a 0-0 home draw against Rayo Vallecano in the first round.

Barcelona next hosts Athletic Bilbao before welcoming Bayern Munich in the Champions League in a match in which it might already be eliminated depending on Inter Milan’s result earlier in the day.

Villarreal dropped to ninth place. Unai Emery’s team had beaten Osasuna in the previous round to end a four-game winless streak in the league.

The three goals Villarreal conceded matched the number of goals it had allowed in all other league games so far. It had arrived at the Camp Nou with the league’s best defense.

”Nothing worked for us from the start,” Villarreal midfielder Manu Trigueros said.

There was a moment of silence before the match because of the death of Villarreal vice president Jose Manuel Llaneza, considered the architect of Villarreal’s project that led the club to its recent glories.

OTHER RESULTS

Almeria opened a three-goal lead then held on to a 3-2 win over Girona at home in a match between promoted clubs.

Girona thought it had completed its comeback but a goal seven minutes into stoppage time was disallowed for a foul.

The visitors dropped into the relegation zone with the loss, while Almeria jumped to 13th place.

Seventh-place Osasuna defeated Espanyol 1-0 at home with a 55th-minute winner by Ante Budimir.

Espanyol dropped to near the relegation zone with the away loss.

AP World Cup coverage: https://apnews.com/hub/world-cup and https://twitter.com/AP-Sports

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