Defending champions Chile are through to the Copa America Centenario quarter-finals after a 4-2 win over Panama on Tuesday.
Eduardo Vargas and Alexis Sanchez scored braces to ensure Chile's spot in the last eight of the tournament despite an early scare.
Miguel Camargo gave Panama a fifth-minute lead at Lincoln Financial Field in Philadelphia - his first international goal - but Vargas restored parity just 10 minutes later.
The Hoffenheim forward added his second two minutes out from the half-time break, before teeing up Sanchez to volley home early in the second half.
Panama scored with 15 minutes left through Abdiel Arroyo to set up a tense finish, but Sanchez struck a second in the closing stages to seal Chile's passage into the knockout stages. It means Chile are likely to finish second to Argentina in Group D and face Mexico in the last eight.
Juan Antonio Pizzi made three changes to his Chile line-up, bringing in Vargas, Marcelo Diaz and Jose Fuenzalida for Mauricio Pinilla, Fabian Orellana and Pablo Hernandez.
Panama, needing a win, made five changes from the side that were routed 5-0 by Argentina, including Camargo for Armando Cooper, while the suspended Anibal Godoy was replaced by Amilcar Henriquez.
To the surprise of the pro-Chile crowd, it was Camargo who gave Panama a shock lead inside the opening five minutes.
A defensive error led to a Panama attack before Camargo hit a long-range effort that was misjudged by Claudio Bravo, leaving the Barcelona goalkeeper stunned.
Chile knew a defeat would see them eliminated and looked to get back in the game immediately, with wave after wave of attacks on the Panama defence, who were holding firm.
That was until a neat one-two between Sanchez and Arturo Vidal opened up some space for the former to have a shot on goal, which was brilliantly saved by Jaime Penedo.
However, Vargas was quickest to react to the loose ball in the area, slotting home from close range to level.
Vidal had two gilt-edged chances soon after to put Chile ahead, his first a header superbly kept out by Penedo, before a second effort less than 30 seconds later went just over the crossbar.
But Chile's pressure did eventually lead to a second goal, with Vargas heading home a teasing Jean Beausejour cross on the stroke of half-time.
Panama coach Hernan Dario Gomez brought on Gabriel Torres and Arroyo for Luis Tejada and Roberto Nurse for the second half, but changing his forward line could not stop Chile scoring a third.
Vargas was in for his hat-trick but managed to pick out Sanchez at the back post, and the Arsenal star blasted home an unstoppable volley to give Chile some breathing space.
Panama's two substitutes combined five minutes later for a good chance, but Torres could only blast Arroyo's cutback over the bar, before the latter found the net in the 75th minute.
Arroyo was unmarked at the back post after a flick on from a free-kick and his header could not be kept out by Bravo, who fumbled it into his own net.
But Chile made sure of the result in the dying stages, with Sanchez's well-placed header beating Penedo.