Spain has been a member of FIFA since FIFA's foundation in 1904, even though the Spanish Football Federation was first established in 1909. The first Spain national football team was constituted in 1920, with the main objective of finding a team that would represent Spain at the held in Belgium in that same year. Spain made their debut at the tournament on 28 August 1920 against , silver medallists at the last two Olympic tournaments. The Spanish managed to win that match by a scoreline of 1–0, eventually finishing with the silver medal. Spain qualified for their first FIFA World Cup in 1934, defeating in their first game and losing in a replay to the hosts and eventual champions in the quarter-finals. The Spanish Civil War and World War II prevented Spain from playing any competitive matches between the 1934 World Cup and the 1950 edition's qualifiers. At the 1950 finals in Brazil, they topped their group to progress to the final round, then finished in fourth place. Until 2010, this had been Spain's highest finish in a FIFA World Cup finals, which had given them the name of the "underachievers".
Spain won its first major international title when hosting the held in Spain, defeating the 2–1 in the final at the Santiago Bernabéu Stadium. The victory would stand as Spain's lone major title for 44 years. Spain was selected as host of the 1982 FIFA World Cup, reaching the second round and four years later they reached the quarter-finals before a defeat to . Spain reached the quarter-finals of the 1994 World Cup. The match became controversial when Italian defender Mauro Tassotti struck with his elbow inside Spain's penalty area, causing Luis Enrique to bleed profusely from his nose and mouth, but the foul was not noticed nor sanctioned by referee Sándor Puhl. Had the official acknowledged the foul, Spain would have merited a penalty kick. In the 2002 World Cup, Spain won its three group play matches, then defeated the Republic of Ireland on penalties in the second round. They faced co-hosts in the quarter-finals, losing in a shootout after having two goals controversially called back for alleged infractions during regular and extra time.
World Cup champions parade, celebrate as they pass in front of the Air Force
Headquarters in Madrid
At UEFA Euro 2008, Spain won all their games in Group D. Italy were the opponents in the quarter-final match, which Spain won 4–2 on penalties. They then met again in the semi-final, beating them 3–0. In the final, Spain defeated 1–0, with Fernando Torres scoring the only goal of the game. This was Spain's first major title since the 1964 European Championship. Xavi was awarded the player of the tournament. In the 2010 World Cup, Spain advanced to the final for the first time ever by defeating 1–0. In the decisive match against the Netherlands, Andrés Iniesta scored the match's only goal, coming in extra time. Spain became the third team to win a World Cup outside their own continent, and the first European team to do so. Goalkeeper Iker Casillas won the golden glove for only conceding two goals during the tournament, while David Villa won the bronze ball and silver boot, tied for top scorer of the tournament. Spain qualified top of Group I in qualification for UEFA Euro 2012 with a perfect 100% record. They became the first team to retain the European Championship, winning the final 4–0 against Italy, while Fernando Torres won the Golden Boot for top scorer of the tournament.
Two years later, however, they were eliminated from the group stage of the 2014 World Cup. At Euro 2016 and the 2018 World Cup, the side reached the last 16.