A late header from Edinson Cavani gave Uruguay a 1-0 win over Copa America holders Chile on Monday which saw them snatch top spot in Group C at their opponents' expense and set up a quarter-final meeting with Peru.
The striker glanced Jonathan Rodriguez's cross into the net in the 82nd minute to break the deadlock in a finely balanced game played with a fierce competitive edge even though both teams had already sealed their place in the last eight.
Cavani had been sent off in Uruguay's 1-0 defeat to Chile in the 2015 Copa America quarter-finals after being provoked by Gonzalo Jara and he and his team mates celebrated the goal as if it had just won them a trophy.
Chile, who had eased to victory in their first two games with Japan and Ecuador, came close to taking the lead in the second half when Paulo Diaz headed towards goal, but Uruguay defender Jose Gimenez nodded the ball off the line.
Uruguay's Luis Suarez had the best opportunity before the interval when he found space in the area but opted to shoot rather than pass to his unmarked team mates and his attempt was deflected wide.
A spectator got onto the pitch late in the game and after evading security guards was tripped by Chile defender Jara.
Uruguay finished top of Group C with seven points, with Chile coming second on six and having to settle for a more challenging last-eight fixture with Colombia, who are the only side to have won all their three games in the tournament.
Japan came third with two points after drawing 1-1 with Ecuador, a result which condemned both sides and saw Paraguay of Group B sneak into the quarter-finals as the second-best ranked side to finish third despite only picking up two points.
Ecuador's draw with Japan send Paraguay into quarters
Japan and Ecuador were eliminated from the Copa America on Monday after their 1-1 draw gifted Paraguay a quarter-final berth as one of the two best third-placed sides.
A win for either team would have guaranteed them a place in the last eight and Japan had the better of the early stages and took the lead in 15 minutes when Shoya Nakajima scored from 25 meters out.
Ecuador equalised 20 minutes later when Angel Mena pounced on a parried shot to touch home from close range and the South Americans grew into the game, especially in the second half, when their long ball game troubled the young Japanese side.
With both sides needing to win, the game was open and lively, even though it was played in front of the lowest crowd of the tournament so far, only 9,729 people present at the Mineirao stadium in Belo Horizonte.
Both sides had chances to get the goal that would take them through, with substitute Ayrton Preciado slipping a great chance just outside the post for Ecuador in stoppage time, just moments after Japan watched the referee chalk off a goal for offside.
Group C winners Uruguay, who beat reigning Copa America champions Chile 1-0, will face Peru on Saturday, while Chile will take on Group B winners Colombia, the only team to win all three of their first-round games, the day before.
Hosts Brazil play Paraguay in Porto Alegre in the first quarter-final on Thursday, and Venezuela face Argentina at the Maracana stadium in Rio on Friday.