Arturo Vidal scored the winner as Barcelona came from behind to beat Leganes in La Liga on Saturday.

Madrid (AFP) - Barcelona needed a late winner from Arturo Vidal to beat bottom-club Leganes 2-1 on Saturday while Atletico Madrid lost further ground on the leaders by being held to a 1-1 draw away at Granada.

Vidal poked in a fortuitous Barca goal in the 79th minute at Butarque after Luis Suarez headed home a Lionel Messi free-kick to cancel out a brilliant opener from Leganes forward Youssef En-Nesyri.

Barcelona stay top of the table, three points above Real Madrid, who play Real Sociedad later on Saturday, and three above Atletico, even though Diego Simeone’s side have played one game more.

Atleti took the lead against Granada through Renan Lodi in the second half but could only hold it for seven minutes before German Sanchez nodded in for the equaliser.

Barcelona’s gritty victory will come as a relief to coach Ernesto Valverde, whose team now turn their attention to Wednesday’s crunch Champions League group game against Borussia Dortmund at Camp Nou.

A goalless draw against Slavia Prague earlier this month means Barca’s qualification from Group F is no longer guaranteed.

After Dortmund, they then play away at Atletico Madrid in La Liga to start a month that will include trips to Inter Milan in the Champions League and Real Sociedad in La Liga before the season’s first Clasico at home to Real Madrid.

It was important therefore to avoid a slip against Leganes, playing their first game in front of their own fans since appointing Javier Aguirre as coach.

“It was a big win because the game was very difficult,” Valverde said. “The pitch was dreadful, there was a lot of wind and they scored early.

“I don’t want it to sound like an excuse but it made it hard and still we were able to win. It wasn’t a brilliant game but these are the ones you have to win to win the title.”

The home side made the perfect start as En-Nesyri beat Gerard Pique with a wonderful early striker.

Pique has spent the international break juggling football with the Davis Cup, the revamped tennis tournament in Madrid that he is organising through his marketing company.

“There is more noise outside the club than inside,” said Pique after the match. “I think it’s got a bit out of hand - whether I’m in Madrid, eating here, having dinner there - it’s all part of the circus. But I do my job. I come here, I play football. And that’s it.”

Doubts about the defender’s focus would not have been allayed in the opening quarter of an hour.

One pass from Roque Mesa was enough to set En-Nesyri free against the 32-year-old in the 12th minute.

Pique jostled but was taken by surprise as En-Nesyri nipped inside and bent a shot into the far corner. Leganes might have had a second soon after and Pique would have been at fault, the defender allowing Martin Braithwaite in after failing to clear, but Oscar Rodriguez was unable to capitalise.

Crosses were a weakness for Leganes as three Barcelona headers all could have gone in. Suarez went close, Pique hit the post and Suarez did find the net, glancing in Messi’s clipped free-kick for his ninth goal of the season.

Barca’s second owed much to luck but it came from another cross. Pique rose to head in but the ball missed him and cannoned off the foot of Ruben Perez. Vidal was waiting on the line to prod in.

Atletico were unable to find a winner as they played out their seventh draw of the season, the joint most in the division.

Lodi scored his first La Liga goal after being slipped though by Hector Herrera but Herrera was at fault for the equaliser, losing his marker as Sanchez powered in a superb header to earn Granada a point.