The two countries have played each other on eight occasions, with Brazil winning four matches and Spain two, while the other two have ended in draws.
We have selected the top five encounters between the two nations ahead of their showdown in Rio de Janeiro.
May 27, 1934: Spain 3 Brazil 1
Back in the days when the FIFA World Cup was a straight knockout tournament, Spain ended Brazil's dreams at the first hurdle. More than 20,000 fans attended the Stadio Luigi Ferraris in Genoa, Italy, and saw Jose Iraragorri bag a double for Spain. The winners scored all three of their goals in the first 30 minutes and held on despite Leonidas' consolation in the second half.
July 13, 1950: Brazil 6 Spain 1
The South Americans claimed revenge for their 1934 defeat with a thrashing of Spain in the final round of the 1950 FIFA World Cup, which was played over a group stage. Chico scored twice as Brazil netted three goals in each half. They led 6-0 at one stage as they romped to victory in front of a crowd of more than 150,000 in Rio de Janeiro, but Brazil were edged by Uruguay in the final of the tournament.
June 6, 1962: Brazil 2 Spain 1
The two sides were drawn against each other in the group stage of the 1962 FIFA World Cup in Chile, with Brazil winning again. Adelardo Rodriguez gave Spain a first-half lead but Amarildo netted twice in the final 20 minutes to give Brazil victory in a tournament that they would ultimately win.
June 1, 1986: Brazil 1 Spain 0
Again Brazil and Spain were put in the same group at a FIFA World Cup and Brazil were victorious once more. They came out on top in this Group D encounter at the 1986 tournament in Mexico thanks to a goal from Socrates in the second half. Both nations were bundled out of the tournament at the quarter-final stage after losing penalty shootouts to France and Belgium respectively.
September 12, 1990: Spain 3 Brazil 0
Spain's first win over Brazil for 56 years came in Gijon, as Carlos' early strike set the ball rolling. Fernando and Michel netted after the break as the hosts romped to victory in the friendly.