The friendly at the Estadio Morumbi in Sao Paulo was Brazil's final test before the host nation take on Croatia in the tournament's opening game next Thursday.
That match will be played in the same city, but at a different venue - the Arena Corinthians.
Despite being so close to the beginning of the official competition, Brazil coach Luiz Felipe Scolari fielded most of his usual starters such as Neymar, Daniel Alves and Thiago Silva and may therefore be concerned at the nature of the performance.
The Selecao were unable to break the tough Serbian defensive line until the 58th minute and were being booed when Fred scored.
Silva's diagonal pass was chested down by Fred on the edge of the box and he steered the ball home, despite slipping on the pitch in the penalty area.
It was a cruel blow to the Serbs, who had out-fought their more illustrious opponents and created the best chances, particularly in the first half.
Brazil looked shaky in the air with Aleksandar Mitrovic putting a free header wide after 30 minutes and Milos Jujic seeing his header hit the post midway through the second half.
Hulk had the ball in the net for Brazil after 73 minutes but the goal was ruled out for offside and Jo brought out a fine finger-tipped save in the closing seconds.
"Today's rivals were both physically and defensively strong," striker Hulk told Globoesporte.com after the game.
"We found it difficult to break two four-man defensive lines. We needed some patience."