MOSCOW (AP) -- Worried no more, Brazil is through at the World Cup.
Paulinho and Thiago Silva scored a goal each Wednesday to give the five-time champions a 2-0 victory over Serbia and first place in their group.
Brazil struggled in its opening two matches, first held to a 1-1 draw and then needing late goals to win the other. But they controlled this one.
Paulinho gave his team the lead when he met a lofted ball from Philippe Coutinho in the 36th minute. The defensive midfielder let the ball bounce in front of him near the penalty spot and kicked his right leg in the air to tap it over the goalkeeper's fingertips.
Silva later scored with a powerful header in the 68th from Neymar's corner.
Brazil finished first in Group E and will next face Mexico in the round of 16 on Monday in Samara. Serbia was eliminated, finishing third in the group behind Switzerland.
Both of Brazil's goals came when Serbia threatened to get back into the match.
The Serbs nearly scored in the 61st when Brazil goalkeeper Alisson pushed the ball into the path of forward Aleksandar Mitrovic, whose shot bounced off the keeper and was bound for goal before being cleared by Silva.
For most of the first half, Brazil couldn't break through Serbia's compact back line. But the player that coach Tite calls his "secret weapon" lived up to his name by scoring the first goal at Spartak Stadium.
Brazil had an early setback when left back Marcelo was substituted in the 10th minute, limping off the field. Filipe Luis, who is playing at his first World Cup after failing to be selected in 2010 and 2014, was brought on to replace him.
The Brazilian soccer confederation later said Marcelo only had a back spasm and was fine.
This was a more assured performance from Brazil compared to its first two group matches. There was patient buildup play and the Brazilians sometimes rested in possession, exchanging short passes in their own half to slow down play.
Brazil did what it had to do to win, making sure it wasn't the second big team to exit the tournament after 2014 champion Germany was knocked out by South Korea.
Brazil needed only a draw to advance, while Serbia needed to stop Neymar and go for the win. The victory was good for first place.
Switzerland also advanced after a 2-2 draw with Costa Rica and will next face Sweden on Tuesday in St. Petersburg.
KEY TO SUCCESS
Silva popped up just at the right time for Brazil, and not only in defense.
Mitrovic's shot had gone behind Alisson and was heading toward goal, but Silva got there in time to clear it away. He then jumped above Serbia's defense from a corner for Brazil's second goal.