Lionel Messi came off the bench to haul Barcelona back from a goal down against Real Betis to win 3-2 but it was winger Francisco Trincao who snatched victory by choosing the perfect moment to score his first goal for the club.
Barca coach Ronald Koeman took the surprising decision to leave Messi and the in-form Frenkie de Jong out of his starting lineup, perhaps with next week's Copa del Rey semi-final first leg at Sevilla in mind, and saw his side fall behind to a Borja Iglesias strike on the counterattack in the 38th minute.
Messi levelled for Barca in the 59th, less than two minutes after coming on, and then helped his side find a second goal by releasing Jordi Alba with a sumptuous pass which led to Betis defender Victor Ruiz sending the ball into his own net.
Ruiz made amends by powering in a header from a Nabil Fekir free kick in the 75th minute but Portuguese Trincao had the final say, smashing a shot from just inside the box in off the crossbar in the 87th to finally get off the mark for Barca in his 17th appearance in all competitions.
"I didn't need to score for my own good but you have to help out when you can and I'm very happy that we managed to get the win," Trincao told reporters.
"My team mates have always encouraged me and they all congratulated me on the goal."
Barca, who have won their last six league games, are second in the standings on 43 points, seven behind leaders Atletico Madrid who have two games in hand.
The Catalans also pulled off an impressive comeback win against Granada in a Copa del Rey quarter-final tie on Wednesday, clawing their way back from two goals down to win 5-3 in extra-time.
Barca defender Ronald Araujo was forced off in the 12th minute with an ankle problem and Koeman took another unorthodox move by sending on De Jong, who has recently reinvented himself as an attacking midfielder, to deputise at centre back.
The Catalans produced another chaotic display in defence but compensated thanks to their star-studded attack, particularly after Messi and Trincao came on in a double change from Koeman.
"We changed our attitude in the second half and that was the most important factor in getting the victory," added Trincao.
"In the first half we were a little fearful and we didn't take many risks."
PSG beat Marseille to keep pace with Lille and Lyon
Paris St Germain claimed a clinical 2-0 win at bitter rivals Olympique de Marseille on Sunday to keep pace with fellow Ligue 1 title contenders Lille and Olympique Lyonnais.
Kylian Mbappe and Mauro Icardi found the back of the net in the first half to put third-placed PSG on 51 points from 24 games, three behind leaders Lille and one adrift of Olympique Lyonnais, who also won their matches this weekend.
The result left troubled Marseille, who have lost four of their last five games and had Dimitri Payet sent off in the last minute, in ninth place on 33 points from 22 games.
Earlier, Jonathan David scored twice as Lille beat Nantes 2-0 away to claim their sixth consecutive victory, while Lyon humbled Racing Strasbourg 3-0 on Saturday.
Marseille have been hit by off-field problems, with supporters breaking into the training centre amid protests against president Jacques-Henri Eyraud, coach Andre Villas-Boas being suspended after offering to resign and city mayor Benoit Payan saying he wanted to sell their Stade Velodrome stadium.
The club were, therefore, in desperate need of a victory against PSG, but the French champions made sure that would not happen.
Mbappe put the visitors in front after nine minutes, outsprinting Hiroki Sakai and beating keeper Steve Mandanda with a left-footed effort after being set up by Angel Di Maria for his 16th league goal of the season at the end of a lightning-quick counter attack.
Di Maria, however, limped off the pitch with a possible thigh injury one minute later and was replaced by Pablo Sarabia, nine days before PSG travel to Barcelona for their Champions League last-16 first leg.
Icardi doubled PSG's tally on 25 minutes, deflecting Alessandro Florenzi's cross with the back of his head into the far top corner.
The Argentine, who was denied a penalty after being pulled down by Sakai on the hour, was then substituted for Neymar in the 65th minute as the Brazilian came off the bench having been a pre-match doubt due to gastro-enteritis.
Marseille finished with 10 men when Payet was shown a straight red card for a reckless challenge on Marco Verratti.
Immobile strikes again as Lazio beat Cagliari for sixth win in a row
Ciro Immobile’s 14th league goal of the season was enough to earn Lazio a hard fought 1-0 win over struggling Cagliari on Sunday that extended their Serie A winning run to six games.
A defensive approach from the visitors left Simone Inzaghi’s side frustrated until Italy striker Immobile latched onto a Sergej Milinkovic-Savic knock-down to fire in from close range after 61 minutes.
The 30-year-old is second only to Juventus’ Cristiano Ronaldo, with 16 goals, in the Serie A scoring charts.
Cagliari played more expansively after going behind and threatened late on when substitute Gaston Pereiro blasted over from a promising position moments after coming on.
But Lazio held on for a victory that moved them ahead of Napoli and Atalanta into fifth place, level with rivals AS Roma in fourth on 40 points.
The defeat extended Cagliari's winless league run to 14 games, and left them in 18th place on 15 points.
Earlier on Sunday, Musa Barrow scored twice and Riccardo Orsolini added a late third as 13th-place Bologna deepened Parma’s crisis with a 3-0 away win in the Emilia Derby.
Roberto D’Aversa’s side are without a league win since Nov. 30, a run of 12 games, and have lost the last three in a row to sink to 19th place with 13 points, three adrift of the safety zone.