Lionel Messi finally ticked the last empty box in his glittering soccer career on Saturday night, leading Argentina past host Brazil, 1-0, in the final of the Copa América in Rio de Janeiro.

The trophy was Messi’s first with Argentina after a string of painful, agonizing, maddening failures, including perhaps the most demoralizing defeat of his career — against Germany in the World Cup final — inside the same stadium, Rio’s hulking Maracanã, in 2014.

When the whistle blew to end the final, Messi — his relief palpable — dropped to his knees and was immediately surrounded by his teammates. Moments later, they were lifting him above their shoulders and tossing him in the air.

In more than a decade at the top of his sport, Messi, 34, had won nearly every soccer honor imaginable with his Spanish club team, Barcelona, every award, every accolade, every cup, championship and trophy.

And year after painful year, he had failed to win a thing with Argentina.

His friend Angel Di María delivered the prize at last, putting Argentina ahead in the 22nd minute after coolly collecting a long cross-field pass to the right wing from the deep-lying midfielder Rodrigo De Paul. Controlling the ball on the bounce with a single deft touch with his left foot after it skipped past the Brazil left back Renan Lodi, Di María then settled himself and — lifting the ball with the same foot on the rise off its next bounce — sent a shot over Brazil’s goalkeeper, Ederson, that landed softly in the back of Brazil’s next.

As Messi and the rest of Argentina’s team raced to celebrate with Di María, the Brazilians stood, stunned. The goal was only the third they had allowed in the tournament.

Messi had carried Argentina over the last month in Brazil as he chased the kind of trophy he has coveted for so long. He led the Copa América in scoring this summer, with four goals and five assists, but he had done that before, too, and then fallen short of ultimate victory.

The sting of repeated failures — at the World Cup in 2014, and in the Copa América final in 2015 and again in 2016 — had seen Messi retire from the national team at least twice. But both times he had relented, and returned, to chase that first senior title. This month, Argentina’s players had made it their mission to deliver it and they did it .