Cordoba: Alexandre Pato and Neymar scored two goals each as defending champion Brazil hit form with a 4-2 win over Ecuador on Wednesday to secure a Copa America quarterfinals spot.
Brazil finished atop Group B and advanced to a knockout match against Paraguay. Ecuador was eliminated.
Pato scored with a header in the 28th minute and a close-range shot in the 60th, while Neymar netted from inside the area in the 48th and 76th.
Striker Felipe Caicedo scored for Ecuador in the 37th and 58th.
"It was the type of match we needed," Pato said. "It was like a final to us and we had to win it no matter what. We did it and advanced in first place, which is what we wanted."
Brazil was coming off draws against Venezuela and Paraguay in the group stage and needed at least a draw to keep alive its hopes for a third straight title in the South American championship. Host Argentina had also been in danger of being eliminated in the group stage before beating Costa Rica 3-0 on Monday to advance.
"It was our best performance in the tournament," Brazil coach Mano Menezes said. "We are going to be facing Paraguay with the same respect we played them the first time. Now there is no time recover, we need to win against every opponent."
Brazil ended with five points, equal with Venezuela but ahead on goal differential. Paraguay, which allowed two late goals in a draw with the Venezuelans earlier Wednesday, advanced with three points as one of the two best third-place teams in the three groups.
"We played with that will to win," Pato said. "Everybody expects Brazil to always play a great match but it's very hard, all teams want to beat the Selecao and today it wasn't different. Now it's time to get back to work. It's a new Copa America."
Brazil played better Wednesday than in its previous two matches and controlled the action at the Estadio Mario Alberto Kempes. Ecuador didn't make it easy, however, and threatened when it had the ball in attack, especially with Caicedo.
"We leave hurting a little," Caicedo said. "We had the character to equalize two times, but we lacked focus at the end. We gave too many spaces to Brazil and that can't happen."
With right back Maicon playing well in his debut in the Copa America after replacing Daniel Alves in the starting lineup, Brazil was able to keep the ball for most of the match and created more scoring opportunities.
"The plays happened and we had some very good moments during the match," left back Andre Santos said. "We have to build on what worked and improve even more for Sunday (against Paraguay)."
Neymar, who had struggled in the first two matches, fired a dangerous long-range shot over the crossbar just two minutes into the match, and a minute later defender Thiago Silva's header off a corner just missed wide.
Pato's header opened the scoring. Left back Andre Santos crossed the ball into the area and the AC Milan striker came rushing in to firmly nod it into the right corner of Ecuador goalkeeper Marcelo Ramon Elizaga's net.
Robinho, back in the starting lineup after being benched against Paraguay, had a chance to increase Brazil's lead after a perfect pass by Maicon in the 36th, but his hard shot from inside the area hit the right post.
A minute later, Caicedo equalized after a blunder by Brazilian goalkeeper Julio Cesar, who allowed the striker's weak shot from the top of the area to get underneath him.
Ecuador twice had chances to get ahead at the end of the first half after powerful shots by midfielder Michael Arroyo Mina. Julio Cesar made a terrific save in the 44th to stop the first, and the second just missed wide in the 45th.
Brazil improved again after halftime and scored early after Ganso's perfect through pass to Neymar, who scored with a right-foot strike from near the penalty spot.
Pato barely missed with a header in the 56th after another good cross by Maicon before Caicedo struck again, sending another low shot past Julio Cesar from just inside the penalty box.
Brazil got ahead again via Pato in the 60th. Ganso shot from outside the area and Elizaga failed to hold on to the ball, allowing Pato to come in and score from close range.
Brazil kept pressuring and Maicon had his own chance to get on the board with a shot in the 62nd, but Elizaga made the save.
Neymar sealed the victory in the 76th, completing a cross by Maicon after a great run on the right side, and Elizaga saved another shot by Maicon in the 88th in the final scoring opportunity.
"It's frustrating to seek a higher goal but not be able to do it," Ecuador coach Reinaldo Rueda said.
Brazil had struggled in the 0-0 draw with Venezuela and the 2-2 draw against Paraguay, when it needed a last-minute equalizer to avoid defeat.
Menezes has been revamping Brazil since he took over the squad after its elimination in last year's World Cup in South Africa. He brought a few veterans to Argentina like Maicon but most are younger players being prepared to lead Brazil in the 2014 World Cup it will host.
Brazil: Julio Cesar, Maicon, Lucio, Thiago Silva, Andre Santos, Lucas Leiva, Ramires, Robinho, Paulo Enrique Ganso (Elias, 76), Alexandre Pato (Fred, 84), Neymar (Lucas, 79).
Ecuador: Marcelo Elizaga, Neicer Reasco (Gabriel Achilier, 81), Norberto Araujo, Frickson Erazo, Walter Ayovi, Oswaldo Minda, Christian Noboa (Edson Montano, 89), Michael Arroyo Mina, Edison Mendez (Arrinton Mina, 76), Christian Benitez, Felipe Caicedo.
Referee: Roberto Silvera (Uruguay).