The win at the Santiago Bernabeu Stadium moved Madrid to second place, one point behind Girona which came from behind to win 2-1 at Villarreal.
Girona hosts Real Madrid in the league on Saturday.
Madrid was in control from the start at the Bernabeu and missed chance after chance until Díaz finally opened the scoring with a high shot from near the penalty spot three minutes into first-half stoppage time.
The hosts had 18 attempts in the first half alone, with eight of them on target. Las Palmas had no shots on target until after halftime.
Newly arrived striker Joselu grew increasingly frustrated after failing to capitalize on several good scoring opportunities until finally finding the net with a header in the 54th.
Díaz started in place of new signing Jude Bellingham. The 20-year-old England midfielder started on the bench for the first time this season after scoring six goals in his first seven matches with Madrid in all competitions.
Forward Vinícius Júnior, returning from injury, also started on the bench. He replaced Joselu early in the second half.
Madrid endured yet another injury setback when defender David Alaba was substituted in the first half because of an apparent muscle problem. The club has been playing without goalkeeper Thibaut Courtois and defender Éder Militão because of long-term knee injuries.
It was the fourth loss for promoted Las Palmas, which beat Granada in the previous round for its first win of the season.
GIRONA KEEPS WINNING
Girona rallied to beat Villarreal and extend its stunning start to the season.
Villarreal is winless in three matches in all competitions.
AP soccer: https://apnews.com/hub/soccer
Tales Azzoni, The Associated Press