Pele struck 643 competitive goals for Santos during an 18-year stay with the Brazilian club. He left for the New York Cosmos in 1975 and until Messi's goal, the record had stood ever since.
Gerd Muller came closest to matching Pele's one-club goal-scoring feat. The former Germany international netted 565 times for Bayern Munich between 1964 and 1979. The top five is completed by Fernando Peyroteo (Sporting CP 1937-49, 544 goals) and Josef Bican (Slavia Prague 1950s, 534 goals).
"When I started to play football, I never thought I would break any record. Especially not the record held by Pele that I now hold," Messi wrote on Instagram after Tuesday's game. "I can only give thanks to everyone that has helped me throughout the years, my teammates, my family, my friends and everyone that supports me every day."
Laporta: Barcelona have repeatedly lied to Messi
Barcelona Presidential candidate Joan Laporta feels Messi has been let down but believes he will stay at the club.
The only other active player still in the top 10 is Cristiano Ronaldo, who scored 450 goals for Real Madrid. The Juventus striker is 10th behind Jimmy McGrory (Celtic 1922-37, 522 goals), Jimmy Jones (Glenavon 1951-62, 517 goals), Uwe Seeler (Hamburg 1953-72, 507 goals) and Eusebio (Benfica 1961-75, 473 goals).
Messi's Barcelona goals have been spread across 16 years in the club's first team. He scored his first professional goal in 2005 against Albacete as a 17-year-old.
Along with Ronaldo, who played for Manchester United before Madrid and Juve, Messi has taken goal scoring to new heights over the past decade. Everyone else in the top 10 has been retired for at least 40 years.
Messi reached his zenith in the 2011-12 season, Pep Guardiola's final year in charge of Barcelona, when he scored 73 goals in all competitions. That tally was sandwiched in between 53 the previous season and 60 the season after.
The Argentina forward has scored more than 50 goals in a season on six occasions, including 58 in 2014-15 when he won his second Treble as a Barca player.
However, it looked like Pele's record would be left to stand this past summer when Messi pushed for a move away from Barcelona after 20 years in Catalonia.
Messi believed a clause in his contract, which expires in 2021, allowed him to leave for free but eventually backed down when it became apparent the only way to try to invoke the clause would have involved a legal battle with the club.
If he had left, he would have done so having scored 634 goals for Barca's first team.
Instead, he ended up staying for at least one more season, which has allowed him to pass Pele's one-club record and continue making history.
Messi replaced Cesar Rodriguez (232 goals) as Barca's top scorer in 2012 and overtook Telmo Zarra (251 league goals) as the record scorer in La Liga in 2014.
In addition to his 644 goals with Barca's senior side, he scored 11 goals for the C team and the B team as a teenager.