After a rare bad foul that led to a yellow card and a Celta Vigo goal, Lionel Messi made up for his error with two perfectly struck free kicks to claim a hat trick and lead Barcelona to another victory.
It was the 34th Spanish league treble for Messi, tying former Real Madrid star Cristiano Ronaldo for the most in the competition.
Messi's hat trick gave Barcelona a 4-1 win over Celta on Saturday, ending the team's two-game winless sequence and leaving it joint top with Real Madrid, which routed Eibar 4-0 with two goals by Karim Benzema.
Sergio Busquets also scored for Barcelona, which was coming off a league loss at Levante and a home draw against Slavia Prague in the Champions League.
"We needed this victory," coach Ernesto Valverde said. "A team like Barcelona has to rebound quickly after a setback."
Barcelona and Madrid have 25 points, two more than Real Sociedad. The Spanish powerhouses have a game in hand because their "clásico" match was postponed until December due to last month's separatist rally in the Catalan capital.
Messi put Barcelona ahead with a penalty in the first half, but his foul near halftime prompted a yellow card, and Celta's equalizer from a free kick by Lucas Olaza.
Messi made up for his blunder with two excellent free kicks, one in first-half stoppage time and the other a few minutes after the break. Both times he sent a curling shot over the wall and into the top corner.
"With Leo, anything is possible," Valverde said. "He is an expert with free kicks. Our opponents are always wary of fouling near the area."
Messi has netted nine goals in his last seven matches in all competitions. He has eight league goals this season, one less than leading scorer Benzema.
"You can't control Messi," Celta coach Óscar García said. "Without him, things would have been different."
MADRID'S GOOD START
Madrid scored three goals in the first 30 minutes to sweep Eibar aside.
Madrid was up 2-0 by the 20th minute after goals by Benzema and Sergio Ramos. Benzema added another in the 29th and Federico Valverde netted in the 61st.
The victory came three days after Madrid took a three-goal lead by the 14th minute of a 6-0 rout of Galatasaray in the group stage of the Champions League.
Benzema's second goal and the strike by Ramos came from penalties after fouls on Eden Hazard and Lucas Vázquez.
It was only the third away win by Madrid in 11 league matches since coach Zinedine Zidane returned to the club late last season.
The team has kept a clean sheet in five straight matches in all competitions, since a 1-0 loss at Mallorca in the league.
Eibar, which was coming off two straight wins, dropped to 15th place, staying six points clear of the relegation zone.
VALENCIA WINS LATE
Valencia bagged two late goals to beat Granada 2-0 and move closer to the top.
Daniel Wass scored from close range in the 74th and Ferrán Torres struck in stoppage time to give Valencia its third straight victory.
Valencia has the same 20-point haul as Granada, which got off to a great start in its return to the first division but has lost three consecutive matches.
Valencia was coming off wins over Lille in the Champions League and Espanyol in the league.
Lucas Pérez scored his seventh goal in as many matches as Alavés defeated Valladolid 3-0 to move further away from the relegation zone.
Pérez converted a 75th-minute penalty for Alavés, which jumped to 14th with 15 points.
The former West Ham striker has scored in each of his last seven matches, surpassing his overall goal tally for last season.
Joselu and Tomás Pina had scored the first two goals for the hosts in the opening half.
Valladolid, which is 13th, had lost only one of its last seven league matches.