Lionel Messi beat Diego Alves from the penalty spot with almost the last kick of the game to give Barcelona an incredible late 3-2 victory over Valencia.
The champions looked set to drop points after Luis Suarez equalised at the end of a breathless 10-minute spell in the second half, during which Munir El Haddadi – against his parent club – and Rodrigo had overturned Messi’s opener.
But the Argentina star converted from the spot with almost the last kick of the game, prompting objects including a water bottle to be hurled at the celebrating Barca players from a furious home crowd.
Captain Andres Iniesta left the pitch on a stretcher after just 14 minutes following a challenge from Enzo Perez, with Barca later confirming knee ligament damage for the midfielder, which will have tempered celebrations for Luis Enrique’s side.
Messi’s fine finish had put Barca ahead after a feisty opening 22 minutes of Cesare Prandelli’s first home game in charge of Valencia, and only some outstanding goalkeeping from Diego Alves kept the hosts’ deficit at one before half-time.
Valencia responded after the break with two excellent finishes in the space of four minutes, before Suarez pounced on another strong Alves save to fire Barca level just after the hour mark.
Suarez and Nani each missed late chances, but Messi fired just beyond the reach of Alves to give Barca victory and move them one point clear of Atletico Madrid and Real Madrid, who both play on Sunday.
Prandelli had called for his side to show their mettle in his first home match in charge, and they set about disrupting Barca’s early rythym in front of a noisy home crowd.
Iniesta’s game was ended after just 14 minutes as he jarred his leg during one robust challenge from Perez, with the Spain star applauded from the pitch by both sets of fans as he was carried off on a stretcher with clear pain in his lower right knee.
Luis Enrique was incensed that Perez, who won the ball, was not even given a yellow card, but Barca responded to the blow in style as Messi gave them the lead on 22 minutes.
Ivan Rakitic, who came on for Iniesta, fed the ball to Messi just inside the area, and the Argentine blasted a shot into Alves’ bottom-left corner, although the keeper was furious that Suarez was not flagged offside as he jumped clear of the strike.
Mestalla’s frustrations grew when Samuel Umtiti escaped a penalty for a push on Rodrigo and Sergio Busquets avoided a second yellow card for a shirt pull, and only a fine reaction save from Alves to deny Suarez one-on-one prevented further fury from the home fans as they watched Jose Gaya go off injured.
But Dani Parejo should have levelled the scores before the break as he collected Rodrigo’s clever reverse pass in clear space six yards out, only for Marc-Andre ter Stegen to block him at the near post.
At the same end, Rakitic spurned a great chance to double Barca’s advantage just after half-time, slamming a rebound off the outside of the post from six yards after Alves had parried a shot from Neymar, who was making his 100th LaLiga appearance.
Valencia punished that miss with aplomb on 52 minutes, as Munir – on at the interval for Martin Montoya – fired a first-time left-footed shot past the static Ter Stegen after being teed up on the edge of the area by Parejo.
Just four minutes later, Mestalla was rocking as Valencia snatched the lead. Nani’s delightful chip over the Barca defence was half-volleyed off the turf and into Ter Stegen’s left-hand corner by the unmarked Rodrigo.
But Suarez capped a breathless 10 minutes with Barca’s equaliser, drilling left-footed into the bottom corner after Alves had brilliantly kept out Rakitic’s header.
Neither side seemed content with a draw, with Nani slicing a good chance wide and Suarez heading over the crossbar, but Messi made no mistake from the spot after Suarez was tripped by Aymen Abdennour 12 yards from goal.
Ugly scenes followed to mar the end of the match, as missiles including a water bottle were thrown at Messi, Neymar and the celebrating Barca contingent, while there was a scuffle involving both sets of players after the final whistle.