The Argentine reached the landmark with a diving header, following up after his initial penalty had been saved by goalkeeper Jaume Domenech.
Pele, widely considered one of the greatest footballers of all time, scored 643 goals for Brazilian club Santos between 1956 and 1974.
Messi scored his first goal for Barcelona in 2005 and needed 748 games to reach Pele’s record.
However, Messi’s celebrations were dampened by Maxi Gomez’s 69th minute equalizer for Valencia.
The draw extends Barcelona’s sluggish start to the season, which has seen the team win just six of its opening 13 matches and fall eight points behind La Liga leader Atletico Madrid.