Spain competed at the 2012 Summer Olympics in London, from 27 July to 12 August 2012. This nation has competed in all but two Summer Olympic Games since its official debut in 1920. Spain boycotted two editions, the 1936 Summer Olympics in Nazi Germany and the 1956 Summer Olympics in Melbourne, as a protest against the Soviet invasion of Hungary. In 2012, the Spanish Olympic Committee sent the nation's smallest delegation to the Games since 1988. A total of 278 athletes, 166 men and 112 women, competed in 23 sports.

Spain left London with a total of 17 Olympic medals (3 gold, 10 silver, and 4 bronze), failing short of the total achieved in Beijing by a single medal. Three of the medals were awarded in taekwondo and canoeing, and two each in sailing, swimming, and synchronized swimming. Three Spanish athletes won more than a single medal in London, while all of their competitors in synchronized swimming and taekwondo won at least one medal. Spain's competitors in team sports also proved successful in London, as the women's handball and water polo teams won silver and bronze medals respectively. The men's basketball team managed to repeat its silver medal from Beijing. Spain, however, did not win an Olympic medal in tennis for the first time since it was reintroduced as a full-medal sport in 1988, and in cycling for the first time since that same year. On 21 November 2016, a fourth gold medal was assigned to Spain's Lydia Valentín in Weightlifting (Women's 75 kg) after the IOC disqualified the original medallists in the event for failing doping tests at the Games. In 2021, another two bronze medals were assigned to Spain's Ruth Beitia in Athletics high jump and Alfonso Benavides in Canoeing C-1 200 metres after the IOC disqualified the original bronze medalists in the events for failing doping tests at the Games. These make Spain finally get 20 medals with 4 golds.

Among the nation's medallists were sailor Marina Alabau in women's windsurfing, and sprint kayaker Saúl Craviotto, who previously won gold in Beijing. Three athletes won Spain's first ever Olympic medals in their respective disciplines: triathlete Javier Gómez Noya, slalom kayaker Maialen Chourraut, and freestyle wrestler Maider Unda. Sprint canoer David Cal, who won silver in London, became the first Spanish athlete in history to win a total of five Olympic medals. Meanwhile, Mireia Belmonte became the first Spanish swimmer in history to win two Olympic medals.

Medalists

| width="78%" align="left" valign="top" | Medal Name Sport Event Date Weightlifting Women's 75 kg Sailing Women's sailboard Taekwondo Men's 58 kg Sailing Elliott 6m Swimming Women's 200 metre butterfly Swimming Women's 800 metre freestyle Triathlon Men's Synchronized swimming Women's duet Canoeing Men's C-1 1000 m Taekwondo Women's 49 kg Water polo Women's tournament Taekwondo Men's 80 kg Canoeing Men's K-1 200 m Spain men's national basketball team Basketball Men's tournament Canoeing Women's slalom K-1 Wrestling Women's freestyle 72 kg Alba CabelloOna CarbonellMargalida CrespíAndrea FuentesThaïs HenríquezPaula KlamburgIrene MontrucchioLaia Pons Synchronized swimming Women's team Handball Women's tournament Athletics Women's high jump Canoeing Canoeing C-1 200 metres

| width="22%" align="left" valign="top" |

Medals by sportSport TotalSailing 2 0 0 2Taekwondo 1 2 0 3Weightlifting 1 0 0 1Canoeing 0 2 2 4Swimming 0 2 0 2Synchronized swimming 0 1 1 2Basketball 0 1 0 1Triathlon 0 1 0 1Water polo 0 1 0 1Athletics 0 0 1 1Handball 0 0 1 1Wrestling 0 0 1 1Total 4 10 6 20

Delegation The Spanish Olympic Committee (, COE) selected a team of 278 athletes, 166 men and 112 women, to compete in 23 sports; it was the nation's sixth-largest team sent to the Olympics, but the smallest since 1988. Spain did not qualify athletes in fencing, modern pentathlon, and rowing, but there was only a single competitor in women's freestyle wrestling. Athletics was the largest team by sport, with a total of 46 competitors.

The Spanish team featured several Olympic medalists from Beijing, including sailors Iker Martínez and Xabier Fernández in the open skiff class, and sprint canoer David Cal, who won the silver in two of his events. Race walker Jesús Ángel García became the second Spanish athlete to compete in six Olympic Games, tying the record set by former water polo player Manuel Estiarte. Meanwhile, another race walker María Vasco, and field hockey player Pablo Amat competed at their fifth Olympics. Table tennis player He Zhi Wen, at age 50, was the oldest athlete of the team, while rhythmic gymnast Lourdes Mohedano was the youngest at age 17.

Other notable Spanish athletes featured sprint kayaker and two-time world champion Saúl Craviotto, swimmer Mireia Belmonte in the women's medley, butterfly, and freestyle events, tennis doubles specialist Anabel Medina Garrigues, and NBA basketball players Víctor Claver and Serge Ibaka. Former world number-one male tennis player and defending Olympic champion Rafael Nadal was initially selected by the committee to carry the nation's flag, but he later withdrew from the Games because of an undisclosed injury. On 20 July 2012, NBA basketball star Pau Gasol, who led his team by winning the silver medal in Beijing, replaced Nadal as Spain's flag bearer at the opening ceremony.

The following is the list of number of competitors participating in the Games. Note that reserves for fencing, field hockey, football, and handball are not counted as athletes: SportMenWomenTotalArchery 1 1 2Athletics 27 19 46Badminton 1 1 2Basketball 12 0 12Boxing 2 0 2Canoeing 6 2 8Cycling 15 1 16Diving 1 1 2Equestrian 2 1 3Field hockey 16 0 16Football 18 0 18Gymnastics 5 8 13Handball 14 14 28Judo 2 4 6Sailing 7 7 14Shooting 6 2 8Swimming 3 11 14Synchronized swimming 0 9 9Table tennis 2 3 5Taekwondo 2 1 3Tennis 6 6 12Triathlon 3 3 6Volleyball 2 2 4Water polo 13 13 26Weightlifting 1 1 2Wrestling 0 1 1 Total 166 112 278

Archery

Spain had qualified one archer each in the men's and women's individual events.

AthleteEventRanking roundRound of 64Round of 32Round of 16QuarterfinalsSemifinalsFinal / ScoreSeedOppositionScoreOppositionScoreOppositionScoreOppositionScoreOppositionScoreOppositionScoreRankElías CuestaMen's individual66041 (24)L 4–6Did not advanceIria GrandalWomen's individual61853 (12)W 6–5 (21)L 5–6Did not advance

Athletics

Spanish athletes qualified standards in the following athletics events (up to a maximum of 3 athletes in each event at the 'A' Standard, and 1 at the 'B' Standard):

Men Track & road events AthleteEventHeatQuarterfinalSemifinalFinalResultRankResultRankResultRankResultRankÁngel David Rodríguez100 mcolspan=2 10.345Did not advanceKevin López800 m1:48.273 Qcolspan=2 1:46.666Did not advanceLuis Alberto Marco1:46.863 Qcolspan=2 1:46.196Did not advanceAntonio Manuel Reina1:47.443 Qcolspan=2 1:45.846Did not advanceDavid Bustos1500 m3:41.348colspan=2 Did not advanceÁlvaro Rodríguez3:41.5412colspan=2 Did not advanceDiego Ruiz3:41.527colspan=2 Did not advanceAyad Lamdassen10000 mcolspan=6 28:49.8523Jackson Quiñónez110 m hurdles13.764colspan=2 Did not advanceVíctor García3000 m steeplechasecolspan=4 Did not advanceAbdelaziz Merzougui8:58.2012colspan=4 Did not advanceÁngel Mullera8:38.0711colspan=4 Did not advanceIgnacio CáceresMarathoncolspan=6 2:17:1131Carles Castillejocolspan=6 2:16:1724José Carlos Hernándezcolspan=6 2:17:4834Miguel Ángel López20 km walkcolspan=6 1:19:495Álvaro Martíncolspan=6 Jesús Ángel García50 km walkcolspan=6 3:48:3220Mikel Odriozolacolspan=6 4:02:4842Benjamín Sánchezcolspan=6 4:14:4050

Field events AthleteEventQualificationFinalDistancePositionDistancePositionIgor BychkovPole vault5.50=9 q5.5012Eusebio CáceresLong jump7.9214Did not advanceLuis Felipe Méliz—Did not advanceBorja VivasShot put18.8831Did not advanceFrank CasañasDiscus throw63.7611 q65.567Mario Pestano63.4014Did not advanceJavier CienfuegosHammer throw73.7316Did not advance

Women Track & road events AthleteEventHeatSemifinalFinalResultRankResultRankResultRankAauri Bokesa400 m53.676Did not advanceNuria Fernández1500 m4:13.724 Q4:06.5710Did not advanceIsabel Macías4:13.0712Did not advanceNatalia Rodríguez4:16.1814Did not advanceJudit Plá5000 m15:20.3912colspan=2 Did not advanceMarta Domínguez3000 m steeplechase9:29.714 Qcolspan=2 9:36.4512Diana Martín9:35.778colspan=2 Did not advanceAlessandra AguilarMarathoncolspan=4 2:29:1926Elena María Espesocolspan=4 2:36:1261Vanessa Veigacolspan=4 2:46:5397Beatriz Pascual20 km walkcolspan=4 1:27:568María José Povescolspan=4 1:29:3612María Vascocolspan=4 1:28:1410

Field events AthleteEventQualificationFinalDistancePositionDistancePositionRuth BeitiaHigh jump1.93=2 q2.00Concepción MontanerLong jump6.3019Did not advancePatricia SarrapioTriple jump13.6426Did not advanceÚrsula RuizShot put17.9917Did not advanceBerta CastellsHammer throw68.4121Did not advanceNoraida BicetJavelin throw57.7725Did not advance

Badminton

AthleteEventGroup StageEliminationQuarterfinalSemifinalFinal / OppositionScoreOppositionScoreRankOppositionScoreOppositionScoreOppositionScoreOppositionScoreRankPablo AbiánMen's singlesL 20–22, 11–21W 21–17, 16–21, 21–162Did not advanceCarolina MarínWomen's singlesL 13–21, 11–21W 21–17, 21–72Did not advance

Basketball

Spain's men basketball team qualified for the event by reaching the final of the EuroBasket 2011.«España, finalista y olímpica». El Mundo, 16 September 2011. Men's team event – 1 team of 12 players

Men's tournament

Roster

Group play

Quarter-final

Semi-final

Gold medal match

Boxing

Spain qualified boxers for the following events.

Men AthleteEventRound of 32Round of 16QuarterfinalsSemifinalsFinalOppositionResultOppositionResultOppositionResultOppositionResultOppositionResultRankJosé Kelvin de la NieveLight flyweight L 11–14Did not advanceJonathan AlonsoLight welterweight L 12–16Did not advance

Canoeing

Slalom Spain qualified boats for the following events.

AthleteEventPreliminarySemifinalFinalRun 1RankRun 2RankBestRankTimeRankTimeRankAnder ElosegiMen's C-193.24296.60893.246 Q104.044 Q102.614Samuel HernanzMen's K-187.07191.251287.073 Q97.184 Q96.955Maialen ChourrautWomen's K-198.751107.911098.751 Q108.342 Q106.87

Sprint Spain qualified boats for the following events

AthleteEventHeatsSemifinalsFinalsTimeRankTimeRankTimeRankAlfonso BenavidesMen's C-1 200 m40.9931 Q40.6192 FA43.038David CalMen's C-1 1000 m3:54.5901 Q3:52.7673 FA3:48.053Saúl CraviottoMen's K-1 200 m35.5521 Q35.5972 FA36.540Francisco CubelosMen's K-1 1000 m3:37.7915 Q3:31.8334 FA3:32.5217María Teresa PortelaWomen's K-1 200 m41.2631 Q40.8982 FA45.3264 Qualification Legend: FA = Qualify to final (medal); FB = Qualify to final B (non-medal)

Cycling

Spain qualified riders for the following events.

Road AthleteEventTimeRankJonathan CastroviejoMen's road race5:46:1326Men's time trial53:29.369José Joaquín RojasMen's road race5:46:3744Luis León SánchezMen's road race5:46:0514Men's time trial56:59.1632Alejandro ValverdeMen's road race5:46:0518Francisco Ventoso5:46:3731

Track Sprint AthleteEventQualificationRound 1Repechage 1Round 2Repechage 2QuarterfinalsSemifinalsFinalTimeSpeed (km/h)RankOppositionTimeSpeed (km/h)OppositionTimeSpeed (km/h)OppositionTimeSpeed (km/h)OppositionTimeSpeed (km/h)OppositionTimeSpeed (km/h)OppositionTimeSpeed (km/h)OppositionTimeSpeed (km/h)RankHodei MazquiaránMen's sprint10.604 67.89816 L LDid not advance

Pursuit AthleteEventQualificationSemifinalsFinalTimeRankOpponentResultsRankOpponentResultsRankPablo Aitor BernalSebastian VedriDavid MuntanerAlbert TorresMen's team pursuit4:02.1136 Q3:59.52064:02.7466

Keirin AthleteEvent1st RoundRepechage2nd RoundFinalRankRankRankRankJuan PeraltaMen's keirin32 Q510

Omnium AthleteEventFlying lapPoints raceElimination raceIndividual pursuitScratch raceTime trialTotal pointsRankTimeRankPointsRankRankResultRankRankTimeRankEloy TeruelMen's omnium13.65514553174:29.874921:05.46314599Leire OlaberríaWomen's omnium14.4636312123:46.317141636.39386913