Goals by Paulinho and Thiago Silva steered a much-improved Brazil to a 2-0 victory over a battling but ultimately outclassed Serbia on Wednesday and into a World Cup second-round meeting with Mexico.
The win, combined with Switzerland's 2-2 draw with Costa Rica, meant Brazil finished top of Group E on seven points, two ahead of the Swiss, who will face Sweden in the last 16. Serbia ended in third place on three points and are eliminated along with Costa Rica.
With defending champions Germany knocked out and Argentina scraping through at the death, five-times champions Brazil were desperate to stamp their authority on a tournament where World Cup pedigree has counted for so little.
But, having needed two goals in stoppage-time to beat Costa Rica in their last game having been held 1-1 by Switzerland in their opener, they took a long time to make any impression on a well-drilled and rugged Serbian defence.
However, after 36 minutes a superb lofted pass from just inside his own half by the outstanding Philippe Coutinho sent Paulinho clear and he stretched high to toe the ball over goalkeeper Vladimir Stojkovic and ease the pressure.
Neymar was again well shackled and unable to impose himself, with one dipping shot over the bar and another at the legs of Stojkovic after a lightning counter-attack his only notable contributions in the first hour.
However, while their superstar front men were making little headway at the other end, having conceded three goals in their previous 12 games, Brazil's often-overlooked defence again showed their mettle as Serbia threw more men forward.
Roared on by their outnumbered but deafening fans, striker Aleksandar Mitrovic had one instinctive reaction header blocked on the line and another well saved by Alisson as suddenly another upset seemed possible.
That spell around the hour proved Serbia's high water mark, however, as Brazil made it 2-0 when Silva rose high to thump home a Neymar corner after 68 minutes.
Brazil then knocked the ball around with all the deft skill and control that the neutrals at Spartak Stadium had come to see but even then Neymar couldn't get the goal he so desperately wanted, firing a bouncing shot over the bar and having a final effort palmed clear by Stojkovic.