Costa Rica striker Andy Herron scored with virtually the last kick of the game to give his team an upset 2-1 win over Chile and a place in the Copa America football tournament quarter-finals on Tuesday.
Herron's dramatic winner in the fourth minute of injury time gave the Central Americans a third-place finish in Group C with three points and they qualified as the second best third-placed team in the three first stage groups.
Until Herron struck, Bolivia, who finished with two points in Group A, had been set to go through instead.
Costa Rica will face Colombia in Saturday's quarter-final in Trujillo while Chile went home with one point from their three games.
Both teams needed to win to progress, a situation which produced a dramatic end-to-end match.
Chile went ahead when central defender Rafael Olarra scored in the 39th minute, the Argentine-based player heading the ball into the net following a Luis Jimenez free kick.
Chile had dominated the early stages and seemed set for a comfortable win.
Jimenez nearly increased their lead when he smashed a 30-metre pile driver against the crossbar but after that, the tide turned in Costa Rica's favour.
The Ticos equalised when central defender Mauricio Wright scored from close range in the 59th minute after Walter Centeno broke clear on the right and crossed.
Jimenez nearly won it for Chile with an 89th minute header but his effort was brilliantly turned away by goalkeeper Ricardo Gonzalez.
In Costa Rica's last attack, Herron was sent clear on the right and scored with a low shot into the far corner, leaving his team jumping for joy and their opponents in a state of shock.
There was only time for Chile to kick off before the final whistle went.