Spain began life without Luis Enrique by clinging on for a tense 2-1 victory over Romania to maintain their perfect record in Euro 2020 qualifying.
Sergio Ramos' penalty and a strike from Paco Alcacer put the three-time European champions on course for a comfortable success in their first match since Robert Moreno permanently replaced Enrique as head coach.
But they were forced to survive an anxious finish in Bucharest after substitute Florin Andone halved the deficit with an hour played and defender Diego Llorente was dismissed 11 minutes from time.
Spain, who wasted a string of chances during a dominant first half, were ultimately indebted to goalkeeper Kepa Arrizabalaga after he pulled off two superb late stops to help move his side on to 15 points from five games at the top of Group F.
Former coach Enrique resigned in June due to personal reasons and, ahead of kick-off, there was a minute's silence in memory of his nine-year-old daughter, Xana, who last week died following a battle with cancer.
Alcacer had two opportunities to give Moreno an ideal start to his full-time tenure, the first coming inside 35 seconds.
Romania goalkeeper Ciprian Tatarusanu denied the Borussia Dortmund striker on each occasion, repelling the first effort with his legs before touching the second attempt past the left post.
Tatarusanu was the hosts' most prominent performer in the opening stages and was forced to tip over a header from unmarked Real Madrid defender Ramos following a Fabian Ruiz corner and, minutes later, turn Jordi Alba's volley wide.
The last competitive match between the two countries was at Euro 96 when Spain won 2-1 at Elland Road thanks to a late goal from Guillermo Amor.
Spain continued to dominate and went ahead in the 29th minute through Ramos' 21st international goal and fourth of this qualifying campaign.
Ciprian Deac was penalised for treading on the foot of Dani Ceballos inside the box and Ramos, winning his 166th cap, coolly sent Tatarusanu the wrong way from 12 yards, before being booked for his celebration and booed for the remainder of the match.
The one-way traffic was unrelenting and Tatarusanu saved well from Rodrigo and again from Alcacer to keep the hosts in the contest.
Romania failed to register an attempt on target in the first half. Reading forward George Puscas offered an outlet with his positive running, while he also left Sergio Busquets with a bloodied lip after catching the Barcelona midfielder in the mouth with a flailing arm.
The home team's resistance was broken for a second time inside two minutes of the restart. Slick build-up play led to Arsenal midfielder Ceballos slipping in left-back Alba and he squared across the six-yard box to give Alcacer a simple finish for his 10th international goal in 16 outings.
With the buffer of a second goal, Spain should have cruised to victory. But Romania made a game of it with around half an hour remaining.
Andone, who earlier this week made a loan move from Brighton to Galatasaray, had been on the pitch only three minutes when he nodded past Arrizabalaga after Puscas headed Romario Benzar's right-wing centre back across goal.
Spain struggled to reassert their authority and were reduced to 10 men in the 79th minute after Real Sociedad defender Llorente brought down the lively Puscas when he was through on goal and was deservedly dismissed.
Chelsea keeper Arrizabalaga then ensured his side collected all three points by twice saving from Puscas in added time, while defender Dragos Grigore wastefully fired over.