Goals in either half from Paulinho and Thiago Silva were enough to send Brazil through, as they set up a last 16 clash against Mexico despite not being at their fluent best. Serbia ended in third place with three points.
The selecao left their last match against Costa Rica late, but eventually put two past Keylor Navas in stoppage time to get the win.
Paulinho gave his team the lead when he met a lofted ball from Philippe Coutinho in the 36th minute.
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.
Mitrovic then towered over right-back Fagner near the 65th minute but only to fire his header straight at Alisson with the goal to shoot at. "It was really hard for us to play Brazil, it just a higher class of opponent", Matic said.
Serbia pushed for an equaliser but lacked the cutting edge and were caught by a classic suck-punch when Thiago Silva headed home powerfully from an outswinging Neymar corner on 68 minutes.
That assist was a frustrated Neymar's major contribution as he fired one shot at Stojkovic's legs after a 70-metre counter-attack, bounced another over the bar and saw the keeper palm clear his final effort of a night where he was routinely bullied off the ball and lost possession countless times.
Tite's team went into the game knowing a draw would be enough to see them through, while the Serbs needed a win to guarantee progression for them to the last 16 in Russian Federation.
Switzerland also advanced after a 2-2 draw with Costa Rica and will next face Sweden on Tuesday in St. Petersburg.
But now they are up and running, manager Tite will be confident of beating Serbia and topping the group.