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 on yesterday, 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 yesterday 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 equalise 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.