BARCELONA, Spain — 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.

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 best 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 to his left leg.

But Messi had gone on a minute before in the 64th and he took charge. The club's all-time top scorer raced 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.

"It's clear that Messi can turn a match around, but we have to get used to seeing Messi play half an hour," Valverde said about his 31-year-old star.

Messi missed five matches in October and November while recovering from a right-arm fracture. Otherwise, he had missed only one other match this season to rest.

Suarez's goal puts him in the top five all-time scorers for Barcelona with 167. Messi leads them all with 577 goals.

Barcelona stayed comfortably ahead of second-placed Atletico Madrid with Real Madrid third at 10 points back.

DANGEROUS DEMBELE

The slip that caused Dembele to fall back on his own leg and seemingly twist his left ankle ended another excellent performance by the 21-year-old forward, who is showing why Barcelona paid a then-club record transfer fee to sign him in 2017.

Starting in Messi's spot on the right side of the attack, Dembele impressed Barcelona's supporters and tormented Leganes' defenders, dribbling past opponents or finding teammates with a well-placed pass.

Then came his goal when Dembele imitated the same move Messi has made one of his most dangerous — pass the ball to Alba on the left flank, then float in behind Suarez to the heart of the area where Alba returns the ball. Dembele used the inside of his right boot to redirect Alba's pass off the post and into the net.

With the season only halfway over, Dembele has already scored more goals than in any prior campaign.

He has found the net 13 times through all competitions. He had four goals last season when injuries limited him. Prior to that, he had 10 for Borussia Dortmund in 2016-17, and 12 for Rennes in 2015-16.

"(Dembele) is a great player because he can take on opponents one-on-one, he is fast and he played at a high level," Busquets said. "It is too bad that he got hurt."

CANALES LEADS BETIS

Sergio Canales set up one goal and converted a penalty in injury time to lead Real Betis' 3-2 comeback over Girona.

Canales provided the pass for Loren Moron to make it 2-2 before he converted his spot kick after Douglas Luiz fouled Giovani Lo Celso.

OTHER RESULTS

Hector Moreno and Willian Jose each scored to erase a two-goal deficit and earn Real Sociedad a 2-2 draw at Rayo Vallecano.

Levante beat Valladolid 2-0, while relegation-threatened Villarreal drew 1-1 with Athletic Bilbao.

___

More AP soccer: https://apnews.com/apf-Soccer and https://twitter.com/AP_Sports