Lionel Messi came off the bench to inspire La Liga leaders Barcelona to victory over Leganes – their seventh successive win in all competitions.
Ousmane Dembele fired in to give the champions a first-half lead before Martin Braithwaite, on loan from Middlesbrough, tapped in the equaliser.
Luis Suarez handed Barca the advantage again when he poked home after Messi’s superb free-kick had been saved.
Messi then grabbed the third in stoppage time with a thumping shot.
The result moves Ernesto Valverde’s team to 46 points from 20 games, five ahead of second-placed Atletico Madrid with arch-rivals Real Madrid third with 36 points.
However, it seemed for a while that Barca’s advantage would be only three going into the next round of games.
The fixture began brightly for the Catalan club during a one-sided first half dominated by the brilliance of France forward Dembele, his trickery and sensational pace embarrassing the opposition defence at times.
The first example of his blistering speed came in the 12th minute when he burst into the area before feeding Philippe Coutinho, who fired his shot high over the bar.
Then came his goal. Defender Gerard Pique began the move by dribbling past two Leganes players, before the ball eventually reached Jordi Alba on the left.
The Spaniard found Dembele in the area, who turned his foot and directed a first-time strike past the reach of Ivan Cuellar.
Mid-table Leganes barely threatened the Barca area, but that changed after the break when Braithwaite converted from close range following a swift break.
Messi and Ivan Rakitic were introduced not long after, although Barcelona suffered another blow when Dembele came off with an ankle injury.
Despite that setback Barcelona reasserted their control. They took the lead once more when Cuellar failed to deal with Messi’s strike and Suarez poked in.
And in stoppage time, Messi made certain of the points with a fierce right-foot finish after good combination play with Alba.