At the Arena de Sao Paulo, Neymar found the net either side of half-time to bring Brazil back from the brink after Marcelo had scored an early own goal.
Oscar cemented the result with a wonderful individual goal late on but the adulation went to the Spain-based striker who now look good to be among the top strikers.
Neymar’s first goal was a low, sweeping effort which crept into the net from 25 yards out, while his second was a bit controversial.
Dejan Lovren was adjudged to have fouled Fred in the box and Japanese referee Yuichi Nishimura pointed to the spot.
But television replays showed little contact had been made, even though this necer stopped Neymar from converting to spark scenes of celebration.
The victory ensured a 10th consecutive win for Luiz Scolari’s side but Brazil did not play with the fluency or flamboyance they were known with last year.
Then, they had swept aside Spain to win the Confederations Cup so emphatically.
This time, their performance demonstrated flaws and fragilities, even though they will become harder and harder to beat.
The competition continues Friday with African side Cameroon taking on Mexico in the other Group A match.
Two matches will also be played in Group B, with defending champions Spain taking on 2010 runners-up Netherlands and Chile facing Australia.(NAN)