Pele congratulated Neymar on matching his long-standing goalscoring record for Brazil and urged the forward "to keep inspiring us" amid questions over his international future.
Neymar scored his 77th senior goal for Brazil midway through extra time to open the scoring in Friday's World Cup quarter-final with Croatia at Education City Stadium.
However, Bruno Petkovic equalised in the 117th minute and Croatia stunned Brazil 4-2 on penalties to advance to the semi-finals, where Argentina now await on Tuesday.
Paris Saint-Germain star Neymar suggested after the match he may have played his final game for the Selecao, though he will hold off from making an official decision.
On what was a bittersweet occasion for the 30-year-old, Pele – who has been hospitalised with a respiratory infection – took to social media to hail his compatriot.
"I saw you grow, I cheered for you every day and finally I can congratulate you for equalling my number of goals with the Brazilian national team," Pele posted on Instagram.
"We both know this is so much more than a number. Our greatest duty as athletes is to inspire.
"To inspire our professional colleagues of today, the next generations and, above all, to inspire everyone who loves our sport.
"Unfortunately, the day is not the happiest for us, but you will always be the source of inspiration that many aspire to become.
"I've learned that the more time passes, the more our legacy grows. My record was set almost 50 years ago, and no one has been able to approach it until now.
"You made it, boy. This enhances the greatness of your achievement. However, you know, as I do, that no number is greater than the joy of representing our country.
"I'm 82 years old, and after all this time, I hope I've inspired you in some way to get this far.
"More than that, I hope that your achievement spreads to the millions of people who follow you to challenge what seems impossible.
"Your legacy is far from over. Keep inspiring us. I will continue punching the air with happiness with every goal you score, as I have done in every game I've seen you."
Neymar is just the second Brazil player to score in extra time at a World Cup after Leonidas against Poland in the last-16 stage in 1938.
However, Brazil became the first team in the tournament's history to be eliminated from a knockout match in which they scored the opening goal during extra time.
It means the Selecao's wait for a record-extending sixth world crown will stretch to at least 24 years by the time the 2026 edition comes around.
Discussing his future following the loss to Croatia, in which he did not take a penalty in the shoot-out, Neymar said: "The feeling is really bad.
"It's worse today than what happened in the past. Unfortunately, it's hard to find words to describe this moment. We tried, we fought, and I'm proud of all my team-mates.
"I'm proud of their personality, of taking the penalty, of their character, because it's not easy to assume that responsibility."
Neymar has made 124 Brazil appearances, whereas Pele reached his goals tally in 92 games.
Brazil have been eliminated from four of their past five World Cup quarter-finals, and from each of their past six knockout matches against European nations.