PORTO ALEGRE, Brazil — An estimated 50,000 Argentines completed the trek to this World Cup city by Wednesday morning. Many of the soccer pilgrims were wearing long faces along with their Lionel Messi jerseys as they roamed the parks and the streets and took in the hazy view of Guaíba Lake while carrying hand-lettered signs that read, “Compro” (“I’m buying”).

“It’s shameful; the scalpers are asking for 1,200 to 1,500 dollars for a ticket with a face value of no more than 100,” said Cintia Perri, a young woman from Buenos Aires who had driven 20 hours to get here and spent the night in her car in a nearby camping site.

But Messi would soon lift the mood of his sleep-deprived, ticket-deprived compatriots.

In only the third minute of this final group game, against Nigeria, Messi scored on a rebound. And though the Nigerians struck back almost immediately, Messi scored again in added time at the end of the first half with a perfectly judged free kick from 25 yards that curled over the Nigerian wall and nestled into the upper right corner of the net without being touched by goalkeeper Vincent Enyeama.

It was another masterwork in Brazil from an exquisite player who once reserved his best material for his club team, Barcelona. But Messi is without doubt the leader and inspiration of this Argentine team, whose 3-2 victory secured first place in Group F, with the maximum 9 points and a 3-0 record.