The breakthrough came 10 minutes before the break when Philippe Coutinho picked out Paulinho's run with an exquisite angled through ball from the left and his fellow Barcelona midfielder delicately flicked the ball over Stojkovic.
Those misses were promptly punished in the 68th minute when Neymar sent in a corner from the left and Thiago Silva rose at the front post to beat Nikola Milenkovic to the ball and power home a header.
Serbia looked to continue with their gritty performance at Spartak Stadium but were undone by the sheer quality of the Brazilians. Serbia was eliminated, finishing third in the group behind Switzerland.
"In the second half we tried to play with more risk", Serbia coach Mladen Krstajic said.
The Selecao started positively, but had to replace Marcelo with Filipe Luis, who only returned from a broken leg last month, in the 10th minute, the Real Madrid left-back grimacing as he hobbled down the tunnel with what was later confirmed to be a back spasm.
With the biggest South Korea upset against Germany, in the day's first game, Brazil had all to do if they were to avoid another embarrassing exit like the former champions.
No one would be surprised if they beat the Balkan team and they only need to gain one point to guarantee a place in the knockout stage.
Switzerland also advanced after a 2-2 draw with Costa Rica and will next face Sweden on Tuesday in St. Petersburg.
Mitrovic's shot had gone behind Alisson and was heading toward goal, but Silva got there in time to clear it away. Mitrovic has scored 18 goals in 26 games for Fulham and Serbia in 2018 and is a constant threat, especially from crosses. He then jumped above Serbia's defense from a corner for Brazil's second goal.