Valencia sit 13th on 40 points, five points above the relegation zone, with 3 rounds to go.
Real Madrid remained in third place with 71 points, 14 points behind Barcelona, who won the title last week.
The game didn’t matter to Real Madrid, having lost 0-4 to Manchester City in the second leg of the Champions League final on Wednesday to bid farewell to the tournament knowing Barcelona had already won the title of Spanish champion.
Lopez opened the scoring for Valencia from close range in the 33rd minute.
Real Madrid finished the final minutes with ten players, after Vinicius was sent off due to a row with Valencia players.
The Brazilian winger was the victim of racist chants from the crowd and the game was halted minutes into the second half.
Read the Latest World News Today on The Eastern Herald.