Lionel Messi will face former club Paris St-Germain at the Fifa Club World Cup as Inter Miami drew 2-2 with Palmeiras to reach the knockout stages.
A point was sufficient for both sides to progress and Tadeo Allende and Luis Suarez had Inter cruising at 2-0 in front of 60,914 fans at Hard Rock Stadium.
However the Brazilian club scored two goals in the final 10 minutes - from Paulinho and Mauricio - to ensure they went through as winners of Group A on goal difference.
Inter finished second to set up the meeting with PSG, where Argentina forward Messi played from 2021 to 2023.
Elsewhere in Group A, Egyptian side Al Ahly conceded an 89th-minute equaliser to draw 4-4 with Porto.
Wessam Ali's hat-trick for Al Ahly was cancelled out by goals from Rodrigo Mora, William and Samu Aghehowa before Mohamed Romdhane put Al Ahly 4-3 up in the 64th minute.
However, Brazilian winger Pepe's dramatic late equaliser at Metlife Stadium ensured both sides exited the group phase with two points apiece.
This was a relatively subdued performance overall for Suarez but the 38-year-old Uruguay striker still has a knack of influencing games and produced two key moments.
First, the former Barcelona and Liverpool striker got an assist when he chested the ball into Allende's path for the opening goal.
Then he produced a clinical finish just after the hour mark when he struck a left-footed half-volley into the top corner from a tight angle to make it 2-0.
Palmeiras fought back but Suarez still collected the player-of-the-match award.
Fifa opted to give the one qualifying spot available for the host nation of the Club World Cup to Inter Miami.
It was a decision interpreted by many as an attempt to ensure Messi, one of football's most iconic figures, took part in the tournament.
However, they have proved their worth, becoming the only team from the United States to reach the knockout phase - with both Los Angeles FC and the Seattle Sounders eliminated.
With Messi, who joined Inter in 2023, now set for an intriguing reunion against one of his former clubs in PSG, the tournament's organisers will doubtless feel they made the right call.
"We've achieved the goal we set for ourselves at the start of this tournament, which was to qualify for the round of 16," said Inter head coach Javier Mascherano.
"Despite the fact we're facing arguably the best team in Europe, the Champions League winners, we'll try to approach it with the same humility and the same seriousness.
"If there's one thing this sport has shown us, it's that anything can happen in a match."
PSG defeated the Seattle Sounders 2-0 to seal their place in the knockout stages as the winners of group B.
Lionel Messi's teams have progressed in all 33 group stages they have appeared in over his career.
Messi and his Inter Miami colleagues will take on his former club and current Champions League holders PSG in Atlanta in the last 16 on 29 June.
Palmeiras will meet fellow Brazilian side Botafogo in Philadelphia the previous day.