Ilkay Gundogan stroked home a stoppage time penalty to grab champions Barcelona a barely deserved 2-1 win at Las Palmas on Thursday.

Xavi Hernandez's side badly needed to win after leaders Real Madrid and Girona did so on Wednesday, with victory leaving the Catalans seven points behind the top two.

Barca were at times outplayed by the mid-table Canary Islanders, who took the lead through former Blaugrana striker Munir El Haddadi in the 12th minute.

Ferran Torres pulled Barcelona level in the second half and Gundogan netted the winner from the spot after he was shoved over in the box when poised to head into an empty net.

Las Palmas coach Francisco Garcia Pimienta, formerly in charge of Barcelona's reserve side, and his team offered their illustrious visitors a largely frustrating night.

Joao Cancelo hurt his left knee in a challenge in the opening stages and was forced off in an early blow for the Catalans, who struggled badly in the first half.

Another swiftly followed with former Barcelona striker Munir tucking home after being set up by a low cross from Sandro Ramirez, another former Blaugrana youth academy product.

Inaki Pena tipped a low Sandro strike wide as the hosts had the better of the first half with Xavi's side looking disconnected and even disinterested at times.

The visitors' first chance came when Frenkie de Jong sent Sergi Roberto scuttling through on goal but his pass for Ferran Torres was cut out by another former Barca player, Mika Marmol. 

Raphinha lashed over after the break as Barcelona stepped up their game, as they have done on multiple occasions this season, while Pena did well to deny Munir at the other end.

Barcelona levelled just over 10 minutes into the second half when a Las Palmas clearance bounced back into danger off the unwitting Robert Lewandowski.

Sergi Roberto laid the ball off for Torres to roll a low effort past the reach of Alvaro Valles.

Marmol could have sent Las Palmas ahead again but nodded wide from a corner when well placed.

Xavi sent on new Barca arrival Vitor Roque for the final 12 minutes, and the Brazilian striker, signed from Athletico Paranaense, looked sharp.

The match was decided when Daley Sinkgraven shoved over Gundogan to concede a penalty, as the German midfielder tried to head home a parried strike.

Sinkgraven was dismissed and Gundogan sent Valles the wrong way from the spot to keep Barcelona's title defence alive.

Roque missed a golden opportunity to score his first Barcelona goal and wrap up the triumph, but his team left both triumphant and relieved regardless.