Lionel Messi scored from two perfectly struck free kicks to claim his first hat trick this season and 34th in La Liga overall, 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 Vigo 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 Oscar Garcia said. "Without him, things would have been different."
(With inputs from AP)