Valencia took the lead through Mouctar Diakhaby‘s header on 29 minutes, but Messi pulled Barca level deep into first-half stoppage time.
Referee Alejandro Hernandez Hernandez pointed to the spot and issued Valencia captain Jose Gaya a red card following a push on Antoine Griezmann in the box. However, after consulting with the VAR, he downgraded the card to a yellow.
Messi stepped up but saw his penalty saved by goalkeeper Jaume Domenech. Valencia failed to clear and Messi was on hand to head home his historic goal from close range.
The result leaves Ronald Koeman’s side eight points adrift of leaders Atletico Madrid, who have played a game less.