Spain made a winning start to Euro 2016 thanks to Gerard Pique's late header, but they were severely tested by a resolute Czech Republic team.
Spain, winners of the Euros in both 2008 and 2012, dominated possession but had to wait until late on to make the breakthrough against Petr Cech and a resolute Czech backline, who came into the tournament with the worst defensive record of the teams who qualified.
Pique was on hand to head home an inswinging cross from the outstanding Andres Iniesta to send Vicente del Bosque's team joint top of Group D with Croatia.
Alvaro Morata had Spain's best first-half chance, forcing Cech into action from close-range in the first half, while Roman Hubnik turned the ball against his own post after the break.
It looked like Del Bosque's men would be held to a frustrating draw, but Pique nodded in his first goal at a major international tournament to ensure they began with a victory two years to the day since their humbling 5-1 defeat to Netherlands at the World Cup.
Spain now play Turkey on Friday as they continue their bid for an unprecedented third consecutive continental title.
A trio of saves from Cech ensured there were no goals in a relatively quiet first period.
Spain came closest to scoring when Juanfran released David Silva on his 100th cap and his cross allowed Morata to stab towards goal from close-range, with the Arsenal goalkeeper making a key stop.
Cech was also on hand to get an important touch to Morata's left-footed effort after the striker had been set up by Iniesta and then pushed away a Jordi Alba strike.
Czech Republic offered little threat going forward, with David de Gea called into action for the first time just before the break, comfortably saving from Tomas Necid.
The post prevented Hubnik from scoring turning Morata's cut-back into his own goal early in the second half, before Nolito had a goal-bound effort blocked.
Hubnik then threatened at the other end, with De Gea getting down sharply to keep out his effort from Ladislav Krejci's delivery, while Cesc Fabregas made a crucial clearance from Theodor Gebre Selassie's goal-bound header.
Del Bosque changed his striker just after the hour mark, with 35-year-old Aritz Aduriz on to replace Morata, becoming the oldest Spain player to appear in the Euros.
Silva lashed a shot wide, while Aduriz was off-target with an overhead kick and a header in the closing stages, and it looked like the Czechs would hold on for a valuable point until Pique struck.
Iniesta floated in a cross from the left and Pique rose to direct a low header beyond Cech from six yards.
That was not the end of the drama, with De Gea making a pivotal stop from Vladimir Darida in stoppage-time as Spain breathed a huge sigh of relief.
Key Opta stats:
- The Spaniards have netted 10 goals in the last five minutes in normal time of Euro finals games, more than any other side
- Spain haven’t conceded a single goal in their last 600 minutes at the European Championships, the longest run in the history of the tournament.
- Tomas Rosicky is now the oldest and youngest player ever to represent Czech Republic at Euro final tournaments (35y 252d v Spain in this game and19y 250d v Netherlands in 2000).
- Spain now have five players with 100 or more caps at Euro 2016 (Casillas, Ramos, Iniesta, Fabregas, Silva), more than any other team.
- Rosicky played 88 minutes for Czech Republic against Spain, after managing just 19 minutes in all competitions for Arsenal in 2015/16.
- Petr Cech made more passes in this game than any other Czech Republic player (36).