Brazil finally came to life in the Copa America to beat Ecuador 4-2 and win Group B.
After draws with Paraguay and Venezuela, Brazil upped the ante against Ecuador and topped the group on goal difference to set up a quarter-final with Paraguay on Sunday.
The Selecao did not have it all their own way in Cordoba, however, and were twice pegged back by Felipe Caceido after Alexandro Pato headed in the opener and then set up Neymar to make it 2-1.
Brazil went ahead for a third time when Pato netted in the 61st minute and Neymar then secured victory when he finished from close range.
Meanwhile, Paraguay secured their passage to the quarter-finals despite conceding two late goals to draw 3-3 with Venezuela.
Salomon Rondon fired Venezuela into an early lead with a well-struck effort but Paraguay drew level when Antolin Alcaraz scored on 32 minutes.
Lucas Barrios then made it 2-1 when he prodded in and Cristian Riveros looked as though he had secured victory when he netted with five minutes remaining.
However, Miku scored in the final minute of regular time and then Grenddy Perozo headed home late on to make it 3-3 and book Venezuela a ticket to face Chile.