Fred's second-half goal against Serbia gave Brazil their 15th win in the last 16 games but Felipe Scolari's side were jeered in Sao Paulo.
The World Cup hosts were frustrated for long periods in their final warm-up game but finally found a way through just before the hour.
Fred cushioned a cross on his chest and stabbed home from close range.
Hulk also had a goal wrongly ruled out for offside but the team were met with boos at both half and full-time.
The Selecao open the World Cup finals against Croatia on Thursday 12 June. They will start the tournament as favourites to win a sixth trophy.