Lionel Messi had to cut short a rare rest break to help Barcelona beat Leganes 3-1 and protect its five-point lead of the Spanish league on Sunday.
Messi came off the bench at Camp Nou with the score at 1-1 in the second half and set up a goal by Luis Suarez before adding one of his own to ensure the victory.
In a month packed with matches and a Copa del Rey clash with Sevilla looming on Wednesday, coach Ernesto Valverde took the risk of leaving his star player on the bench against a Leganes side that had upset Barcelona 2-1 in September.
That move appeared to be the right one after Ousmane Dembele put Barcelona ahead in the 32nd minute.
But Leganes took advantage of a moment of complacency from their hosts when winter reinforcement Martin Braithwaite converted its only scoring opportunity to pull level in the 57th.
To make matters worse, Dembele saw his excellent performance end with an injury when he fell on his left leg, seemingly hurting his ankle.
But Messi had gone on a minute before in the 64th and he took charge. The club's all-time top scorer sped across the top of the area before launching a powerful left-footed shot that goalkeeper Ivan Cuellar blocked with one hand, only for Suarez to rush in and finish it off.
Messi then exchanged four passes with Jordi Alba in quick succession before scoring his league-leading 18th goal of the campaign in stoppage time.
Messi missed five matches in October and November while recovering from a right-arm fracture.