Alexandre Pato and Neymar netted two goals apiece as defending champions Brazil beat Ecuador in Cordoba to advance to the Copa America quarter-finals as Group B winners.
Defeat for Mano Menezes' side at the Estadio Mario Alberto Kempes would have sent them crashing out of the competition, but they produced a battling display to earn a last-eight date with pool rivals Paraguay.
Felipe Caicedo twice got Ecuador back on level terms, cancelling out Pato's opener and then Neymar's second goal for Brazil, but the Selecao moved up a gear when required to do so to ensure their progress - and Ecuador's exit.
Menezes handed Maicon a starting berth at the expense of Barcelona's Dani Alves, the Inter Milan man turning in a star performance for Brazil, while Robinho also returned to the starting XI.
The Brazilians bossed proceedings from the outset but struggled to create clear-cut chances early on.
The deadlock was broken in the 27th minute when Andre Santos crossed from the left and Pato headed home.
Robinho struck the bar as Brazil searched for a second goal, with Maicon's marauding runs down the right causing all sorts of problems for Ecuador.
However, the next goal of the game arrived at the other end, Brazil goalkeeper Julio Cesar failing to hold onto a Caicedo effort on the counter-attack eight minutes before the interval.
Brazil restored their advantage within four minutes of the restart, Pato setting up Santos star Neymar to make it 2-1, but once again the lead was short-lived as another Caicedo shot from outside the box found its way past Julio Cesar in the 58th minute.
Ecuador may have been sensing a shock was on the cards, but when Brazil went ahead for a third time there was no way back.
Goalkeeper Marcelo Elizaga could not hold onto a Neymar shot and Pato pounced on the loose ball to make it 3-2 on the hour mark and then, 11 minutes later, Neymar notched his second after good play on the right by Maicon and Robinho.
The result left Brazil top of the group ahead of surprise package Venezuela - who will play Chile in the quarter-finals - and third-placed Paraguay, with Ecuador bottom of the pile.