Sergio Ramos, who was sent off in stoppage time for a second yellow card, gave the visitors the lead before Willian Jose appeared to have earned a memorable draw for the hosts with a late leveller.
And although Casemiro then nodded home the winner it does little to disguise a desperately poor performance from Zinedine Zidane’s men, who were outplayed and had keeper Keylor Navas to thank for several saves.
The hosts squandered a huge early chance to take the lead after a rare error from Luka Modric gifted possession to Willian Jose on the edge of the area, but the home team striker hesitated before shooting and allowed Navas to close the angle and make a good save.
Las Palmas had another near miss as winger Momo fired over from a narrow angle, while Madrid’s first opportunity fell to Cristiano Ronaldo after a pass from Isco, but his tame shot was easily saved by Javi Varas.
An even clearer opening came Ronaldo’s way when he was released clean through by a brilliant pass from Modric, but the Portuguese star sent his effort too close to the goalkeeper and Varas saved.
The deadlock was broken from the resulting corner, however, as Isco’s left-wing delivery to the near post was met by Ramos, whose bullet header into the top far corner gave Varas no chance whatsoever.