Robert Lewandowski played the hero for Barcelona, netting two goals as La Blaugrana staged a comeback to defeat Alaves, maintaining stride with Real Madrid and Girona in La Liga.
The 2-1 home victory on Sunday moved Barcelona back within two points of second-place Madrid, who routed Valencia 5-1 on Saturday.
Barcelona are four points behind fellow Catalan club Girona, the surprise leaders that came from behind to win 2-1 at Rayo Vallecano, also on Saturday.
Barcelona stayed two points in front of Atletico Madrid, who came from behind to defeat Villarreal 3-1 with a goal and an assist by Antoine Griezmann.
It was the 15th straight league home win for Atletico, surpassing the run of 14 victories in a row at the Vicente Calderon Stadium between May 2012 and February 2013.
Alaves took the lead in a breakaway one minute into the match in Montjuic after Barcelona midfielder İlkay Gündoğan lost possession near midfield, but Lewandowski helped the hosts rebound with a header in the 53rd and a penalty kick in the 78th.
Lewandowski, who was sidelined recently with an injury, had not scored in six matches since getting a double in the 3-2 win against Celta Vigo in September.
"We played a bit better, but we are not going through our best moment,” Barcelona coach Xavi said. "We came through in a match that became difficult. The international break will be good for us, so we can regroup. We will improve, I am certain.”
Barcelona were coming off a 1-0 loss at Shakhtar Donetsk in the group stage of the Champions League.
Two rounds ago, they lost 2-1 to Madrid at home in the first "clasico” of the season in La Liga.
Barcelona then needed a stoppage-time goal to win at Real Sociedad last weekend.
Barcelona extended their unbeaten run against Alaves in the league to 12 league games, with 10 wins and two draws.
Alaves beat last-place Almeria in the previous round to end a seven-game winless streak in the league.
Barcelona remained without injured midfielders Frenkie de Jong and Sergi Roberto, and Xavi also could not count on the suspended Gavi.
Pedri, who was coming off an injury, was back in the starting lineup after coming off the bench in the last two matches.
Teenager Lamine Yamal also started after sitting on the bench during the last four matches.
Before the match, Barcelona women's team player Aitana Bonmati presented the Ballon d'Or trophy she won last month to fans.
Atletico fell behind when Villarreal striker Gerard Moreno scored in the 20th, but the hosts rallied with goals by Axel Witsel in first-half stoppage time, Griezmann in the 80th and Samuel Lino in the 85th.
It was the seventh goal in six matches for Griezmann, who, along with Alvaro Morata, is leading an attack that has scored 29 goals in 12 league matches.
Atletico were coming off a 6-0 rout of Celtic at home in the group stage of the Champions League.
They are unbeaten in 12 games in all competitions, with 10 wins and two draws.
Atletico won all of their six games at home this season, plus the last nine from last season, to set the new club record at the Wanda Metropolitano Stadium.
"It's always a plus to play in front of these fans,” Griezmann said. "They always give us an extra boost.”
The team, coached by Diego Simeone, who last week had his contract extended until 2027, has a game in hand, as a home match against Sevilla in September was suspended because of bad weather.
It was the seventh league loss for 14th-place Villarreal, which had sports director Miguel Angel Tena in charge after coach Jose Rojo Martin, known as "Pacheta,” was fired last week.
Villarreal lost striker Alexander Sorloth because of an injury in the first half. The Norwegian international sustained what appeared to be a hamstring problem.
Ivan Rakitic scored in the 79th minute to give Sevilla a 1-1 draw with rival Real Betis in the Seville derby.
Ayoze Perez put the visitors ahead in the 72nd.
Sevilla, sitting in 13th place, had its winless streak in the league extended to six matches, with five draws in its last five games.
Manuel Pellegrini’s Betis, in seventh place, won five in a row in all competitions, including two straight in La Liga.