Barcelona needed a late header from Gerard Pique to earn a 1-1 draw at city rivals Espanyol on Sunday -- and a new club record.
Gerard Moreno threatened a La Liga upset in the rain at RCDE Stadium when he opened the scoring midway through the second half with a header from substitute Sergio Garcia's cross.
However, central defender Pique headed home an 82nd-minute Lionel Messi free kick to stretch the runaway leaders' unbeaten start to the season to 22 games, the best run in the club's history.
Pique had previously made comments criticising Espanyol, and he was jeered nearly every time he touched the ball. After the equaliser, Pique celebrated by putting a finger in front of his mouth, asking the crowd to be quiet.
There were shoves and heated discussions throughout the match, which was played under steady rain and on a heavy pitch.
Messi, who provided the cross for Pique's header, came off the bench near the hour-mark after getting some rare rest time by coach Ernesto Valverde.
Espanyol had ended Barcelona's 29-match unbeaten streak with a 1-0 victory in the first leg of the Copa del Rey quarterfinals on Jan. 17, when Messi missed a penalty kick. Barcelona eventually eliminated Espanyol by winning the second leg 2-0.
Philippe Coutinho hit the bar in the 22nd minute for Barca, who are now within 10 matches of equalling the national record -- set by Real Sociedad in 1979-80.
Information from the Associated Press was used in this report.