Substitute Aurelian Tchouameni headed Madrid’s winner following a corner on 84 minutes to complete a second-half comeback, reports Xinhua.
Javi Munoz put Las Palmas ahead in the 53rd minute after good work from Sandro, who pulled the ball back for him to score, but Vinicius Jr equalized for Real Madrid in the 65th minute after a defense-splitting pass from Eduardo Camavinga.
Las Palmas looked tired in the closing minutes but also had reason to be unhappy with the referee, who only showed Rodrygo a yellow card after he hit out at Las Palmas keeper Alvaro Valles, and then forgave him a second yellow after he hit Sergi Cardona in the face with his arm.
FC Barcelona are now 10 points behind Real Madrid after losing 5-3 at home to Villarreal.
Gerard Moreno, who had seen a goal controversially ruled out for offside, opened the scoring for Villarreal in the 41st minute and Ilias Akhomach doubled their lead early in the second half.
The entry of Pedri helped Barca turn the game around in 10 minutes, with goals from Ilkay Gundogan, Pedri, and an own goal from Eric Bailly following a free kick.
It looked as if Barca had the game won, but Goncalo Guedes scored a fine equalizer on the break to make it 3-3 with six minutes left to play.
There was controversy in injury time when Barca were awarded a penalty, only to have it overturned by the VAR, and Villarreal then took advantage of defensive chaos to score late goals from Alexander Sorloth and Jose Luis Morales.