The final got off to an incredible start when Brazil took the lead after just 95 seconds, Fred alertly lashing the ball into the net from close range as he lay on the ground, a cross to the back post having bounced off Neymar.
Brazil began the game at a ferocious pace and should have doubled their lead a few minutes later but Oscar shot wide after a lovely flick from Fred.
Paulinho then drew a decent save from Iker Casillas with a clever lob and the Brazilian players thought Alvaro Arbeloa was lucky to escape with just a booking after he pulled back Neymar.
Spain had an early penalty shout waved away and threatened again when Julio Cesar kept out a low shot from Andres Iniesta, Fernando Torres heading the subsequent corner over the bar.
But the Spaniards were looking unusually vulnerable at the back and Fred should have added to his tally, only to be denied by Casillas after latching onto a good pass from Neymar.
Luiz saves the day
David Luiz then saved the day for Brazil at the other end, sliding into the goalmouth to brilliantly clear a Pedro shot which seemed certain to find the corner of the net.And Brazil made the most of their escape, doubling
the lead just before the break when Oscar patiently waited for Neymar to get onside and then released him with a neat pass, which Neymar brilliantly smashed into the roof of the net.
The jubilant Brazilian fans were loving the action and were sent into raptures again just two minutes after the interval when Neymar dummied Hulk's pass and Fred steered the ball into the corner of the net, Casillas only able to get a hand to the shot.
Jesus Navas came off the bench for Spain and quickly won a penalty when he was tripped by Marcelo but Sergio Ramos's spot-kick was just wide of the left-hand post.
The entertainment was unrelenting in a hectic contest as both sides continued to attack and Casillas had to charge out of his goal to foil Hulk, before Marcelo shot into the side netting.
Calamity for Spain never seemed far away and they were down to 10 men with just over 20 minutes left when Neymar ghosted past Gerard Pique, who brought his man down and was red-carded for his trouble, the referee deciding he was the last line of defence.
The proud Spaniards kept fighting and came close to a consolation goal in the final 10 minutes but Brazil goalkeeper Julio Cesar capped a perfect night for the hosts by pulling off a pair of superb saves to deny Pedro and David Villa.