Barcelona striker Luuk de Jong scored a header in added time to give his side a 3-2 win at struggling Levante after a remarkable, end-to-end game in which his side gave away three penalties.
Barca are the first team in La Liga to win a match after conceding three penalties and De Jong's last-gasp goal saw them record a seventh consecutive league win, lifting them into second in the standings on 60 points after 30 games.
But they are still a long way behind leaders Real Madrid, who have 72 points from 31 after beating Getafe 2-0 at home on Saturday. Levante are 19th on 22 points.
Levante took a surprise but deserved lead against a lacklustre Barca in the 52nd minute when captain Jose Luis Morales scored from the spot after a foul by Dani Alves.
Moments later the hosts earned a second penalty, for a handball by Eric Garcia, who had prevented Levante from taking the lead in the first half when he scrambled a shot from Morales off the line.
This time striker Roger Marti stepped up to take it and his effort was saved by Barca goalkeeper Marc-Andre ter Stegen. The visitors quickly made Levante pay, Pierre-Emerick Aubameyang heading home a cross from Ousmane Dembele in the 59th minute.
Teenage midfielder Pedri then gave Barca the lead in the 63rd, thumping a first-time shot into the bottom corner after being teed up by 17-year-old Gavi, who had also been hauled on from the bench in the second half.
Levante then won a third penalty of the second half when Dani Gomez latched on to a through ball and was tripped by Barca defender Clement Lenglet. Gonzalo Melero assumed taking duties and made no mistake against Ter Stegen to level in the 83rd.
But there was time for one final twist in an enthralling encounter when substitute De Jong connected with a Jordi Alba cross and headed into the bottom corner in the second minute of added time.
"The fact we won while conceding three penalties shows we are very competitive and have a winning mentality," said Barca coach Xavi.
"I was concerned about this game because Levante are a difficult side with great players and they have beaten sides like Villarreal and Atletico Madrid. We've earned three golden points that keep us in the fight."
But when pressed on whether Barca had a chance of catching runaway leaders Real, the coach added: "It's very difficult because Real Madrid seldom slip up. But if they drop a few points in the next two weeks we can start to believe a little more."
Serie A leaders AC Milan held to second successive stalemate
Below-par Serie A leaders AC Milan were held to their second successive 0-0 draw and Sunday's stalemate with Torino cut their advantage over second-placed Inter Milan to two points.
The only notable chance in the first half was a Davide Calabria strike that was well saved, with Milan looking nervous in their pursuit of a first Scudetto since 2011.
Torino improved after the interval, with Mergim Vojvoda denied by a excellent acrobatic stop from Milan keeper Mike Maignan before Italy striker Andrea Belotti fired into the side netting.
Milan never really got going and followed their goalless draw with Bologna on Monday with another tame stalemate in Turin, meaning they sit on 68 points from 32 matches, two clear of Inter, who have a game in hand. Torino stay 11th with 39 points.
The weekend belonged to Inter, who beat Hellas Verona on Saturday, and could then watch on as Napoli in third suffered a shock 3-2 defeat at home to Fiorentina before Milan were again disappointing on Sunday.
Without injured veteran striker Zlatan Ibrahimovic again, Milan lacked potency up front, as their struggles in front of goal continued.
"We didn't create much but many situations could have become dangerous," Milan coach Stefano Pioli told DAZN.
"I can't say anything about the spirit and the determination, we are just missing a spark.
"It is a positive result but we are missing the victory. The favourites have had missteps for two or three weeks, it's a competitive championship and there are difficulties for everyone.
"We know we can do better. I don't see an anxious or nervous team."
Elsewhere on Sunday evening in Serie A, a late winner from English defender Chris Smalling earned AS Roma a 2-1 victory over Salernitana in the Italian capital, moving Jose Mourinho's side up to fifth in the standings on 57 points.
Nkunku on target as top-four hopefuls Leipzig storm past Hoffenheim
RB Leipzig's in-form France midfielder Christopher Nkunku scored one goal and set up another as they stormed past European hopefuls Hoffenheim 3-0 on Sunday to boost their chances of a top-four finish in the Bundesliga with five matches remaining.
Nkunku has now scored 17 league goals while creating 12 as Leipzig, unbeaten in their last eight Bundesliga matches, climbed to 51 points in fourth place, three ahead of fifth-placed Freiburg, 2-1 winners at Eintracht Frankfurt.
Hoffenheim are sixth on 44 points.
Bayer Leverkusen, in third with 52, dropped points in a 0-0 draw at VfL Bochum. They host Leipzig next Sunday.
The top four teams qualify for the Champions League group stage next season.
Leipzig, who have blossomed since coach Domenico Tedesco took over in December, were 2-0 up by the 20th minute after Nkunku struck and Marcel Halstenberg extended their lead.
Nkunku then headed the ball on for Dominik Szoboszlai to drill in Leipzig's third goal a minute before the break and make sure of a sixth victory in their last eight league matches.
Hoffenheim, missing nine players through injury and suspension, never got a look in after the break with the game already decided and Leipzig having taken their foot off the gas.
Marseille cement second place with Montpellier win
Olympique de Marseille consolidated second place in Ligue 1 after goals by Bamba Dieng and Cengiz Under secured a routine 2-0 home win against Montpellier on Sunday.
Dieng and Under netted early in the first half to put OM, who were never in any trouble, on 59 points from 31 games.
They trail leaders Paris St Germain by 12 points a week before playing the capital side at the Parc des Princes.
Montpellier, who had goalkeeper Jonas Omlin sent off in the last minute, are 11th on 41 points with little to play for in the remaining seven matches.
It was a one-sided affair at the Stade Velodrome, where Dieng put the hosts in front after nine minutes by tapping the ball in from Amine Harit's cross.
Dieng was then brought down in the area by Jordan Ferri and Under converted the penalty to double the tally in the 19th.
Montpellier never seemed in a position to get back into the contest and the game descended into a lull until Omlin picked up a straight red card for bringing down substitute Luis Henrique.
Stade Rennais are in third place on 56, three points behind Marseille, following a 3-2 victory at Stade de Reims on Saturday, while Racing Strasbourg are fourth a further four points behind after a 1-1 home draw with Olympique Lyonnais.