Lionel Messi had a trio of assists as Barcelona kept pace with La Liga leaders Real Madrid thanks to a 3-2 win over Real Betis in a match that saw both teams finish with 10 players.
Barcelona came into the match trailing Madrid by six points after the leaders beat Osasuna earlier on Sunday and found themselves trailing Betis early when Sergio Canales converted a penalty for hand ball on Clement Lenglet.
The visitors struck right back with an inspired goal to draw level as Frenkie de Jong settled a perfect Messi long ball with his chest and volleyed past Betis keeper Joel Robles with his second touch.
Barca looked ready to add to their lead, but a bad giveaway in midfield sprang the hosts on the counter-attack finished off with a sumptuous strike from Nabil Fekir to put Betis up 2-1.
Betis were seconds away from taking the lead into the dressing room until a free kick into the area fell to Sergio Busquets and he cooly settled it and beat Robles to again draw Barcelona level right before the referee blew the half-time whistle.
Robles came up with two big saves against Messi in the opening 15 minutes of the second half as Barcelona dominated possession but could not find the go-ahead goal.
Lenglet finally headed Barcelona into the lead shortly after the 70-minute mark, out jumping his defender to redirect a Messi cross into the back of the net to give his team a deserved lead.
Both teams were reduced to to 10 players shortly after the go-ahead goal for Barca, as Fekir was given his second yellow card for dissent and Lenglet also getting a second booking for a foul on Joaquin to set up a tense finish.
The result means Barca finish the day exactly where they started, three points behind Real Madrid, and puts an end to a hard week for the defending champions that saw Ousmane Dembele sustain a serious injury, Messi lash out at sporting director Eric Abidal and the team losing 1-0 to Athletic Bilbao to exit the Copa del Rey.
"This is a hugely significant win for us because Betis are a great team and were being roared on by their fans at home," Barca coach Quique Setien told a news conference.
"This is a very important victory because it keeps us near the top of the table and it will give us a huge psychological boost."
Barca, who hired Setien last month after sacking Ernesto Valverde, had not won away from home in the league since beating Atletico Madrid on Dec. 1 and were smarting from a recent defeat at Valencia as well as the last-gasp loss in the Cup to Bilbao.
"It was so important for us to win after losing in the Cup in the last minute but we just had to keep playing in the same way and that's what we did," said Barca's Sergi Roberto.
"It was vital that we found our form and started winning away from home again so we go home feeling happy."
Meanwhile, Setien's opposite number Rubi was left fuming after the match that Roberto was not sent off for a second foul late in the first half.
Rubi said: "Barcelona should have been down to 10 men in the 38th minute, there's no discussion about that. How was that not another yellow card [for Roberto]?
"Although I accept there are some moments they may argue about, too. But it hurts a lot. If they go down to 10, it's a different game."