Spain and Brazil played out a dramatic 3-3 draw in an international friendly encounter at the Estadio Santiago Bernabeu.