Barcelona beat third-placed Getafe 2-1 at home on Saturday to stay on the heels of La Liga title rivals Real Madrid but the champions were made to sweat for all three points by the impressive visitors.
Antoine Griezmann sent the Catalans ahead in the 34th minute with a cool finish with the outside of his left foot after being played in by an outstanding pass from Lionel Messi, while Sergi Roberto doubled Barca's lead five minutes later.
Getafe pulled a goal back in the 66th with a stunning volley from striker Angel Rodriguez, who almost snatched an equaliser but was denied by Barca keeper Marc-Andre ter Stegen, who then flew to the floor to prevent Jaime Mata netting on the rebound.
The victory took Barcelona level on 52 points with Real Madrid, who lead the standings on goal difference and host Celta Vigo on Sunday. Getafe stay third on 42.
Getafe coach Jose Bordalas felt his side were unlucky to lose and claimed Barca were looking to waste time towards the end of the game.
"We put in a fantastic effort and no-one should forget we are a small team and put in a great performance. It's a shame we couldn't get the best result," he told reporters.
"They couldn't wait for the game to end because they were taking their time in every play. Football has been unfair to us today. We played in their half for large parts of the game but we just lacked that bit of quality which the big teams have."
Barca goalscorer Griezmann admitted his side had endured a tough afternoon.
"Getafe are a very difficult team to face, and they are near the top of the table for a reason," he said.
"We tried to stay calm and keep playing the ball out from the back. We found it really tough and we suffered a lot but sometimes it's good to suffer."
The unfashionable Madrid side, who are the youngest club in La Liga, have shaken up the top-flight this season with their intense and aggressive style and went to the Camp Nou on a run of four league wins in a row without conceding a goal.
There was added intrigue due to a long-standing rivalry between Getafe coach Jose Bordalas and Barca's Quique Setien, who had clashed on several occasions in the past due to their opposing football philosophies.
Getafe's high-pressing caused the home side plenty of problems early on and they looked to have taken the lead through Allan Nyom only for the goal to be ruled out after video technology showed the defender had fouled Barca's Samuel Umtiti.
Barca's injury problems deepened when Jordi Alba left the pitch in tears in the first half after suffering a muscle injury which could keep him out of the Champions League match at Napoli and the title showdown away to Real Madrid on Mar. 1.
But Barca grew into the game with the help of his replacement Junior Firpo, who laid on the pass from which Roberto scored their second after Griezmann had broken the deadlock by linking up superbly with Messi.
The quickfire goals were harsh on Getafe but the visitors hauled themselves back into contention through top scorer Rodriguez, who has been linked with a move to Barca as an emergency replacement for the injured Ousmane Dembele.
Getafe continued to cause problems for Barca's defence in the remaining minutes although the Catalans missed chances to rubber stamp their victory as Griezmann and Messi each missed the target.