Cesc Fábregas also missed a penalty on his 100th cap, but Spain were grateful to a fantastic goalkeeping display from David de Gea to seal an eighth consecutive win in Group C.
Slovakia's 4-2 win over Luxembourg ensured they qualify for next year's finals in France in second place. Ukraine finished third and will now face a two-legged playoff in November to try and make it through.
"I always try to do my best and today I played well, but the most important thing was to win," De Gea told Television Espanola.
De Gea has had to wait for his opportunities in the national team despite stunning performances for Manchester United in the past two seasons, but his latest display will only add to the call for Vicente del Bosque to start him ahead of captain Iker Casillas at the finals next June.
"I have to compete as best I can. Today I had some luck, but I need to continue playing like this," added De Gea.
Del Bosque made 10 changes to the side that sealed their place in France with a 4-0 win over Luxembourg on Friday with only Fabregas keeping his place.
Ukraine had plenty of opportunities to take advantage of an inexperienced Spanish back four that had just 11 caps between them prior to kick-off, but a combination of some poor finishing and De Gea kept the hosts at bay.
De Gea was called into action for the first time as he turned Kravets's shot from a narrow angle behind before somehow turning Rotan's volley over the bar with an outstretched leg on 15 minutes.
However, the hosts were caught out by a wonderful move from the visitors five minutes later to open the scoring as Nolito and Thiago Alcantara exchanged passes and the latter marked his first international appearance for 19 months with a lovey cross for Gaspar to head home.
Del Bosque's men had a great chance to double their lead moments later when Fàbregas was brought down by Oleksandr Kucher inside the area.
However, Spain's captain for the evening couldn't convert from the spot as Andrey Pyatov flew to his left to pull of a fine save.
De Gea denied Kravets twice more before the break and Denys Garmash headed over from point-blank range as Ukraine piled forward in the search of an equaliser.
Yet, they were nearly caught on the break when Nolito placed his shot too close to Pyatov with the goal at his mercy.
Chelsea boss Jose Mourinho was in the crowd reportedly keeping an eye on Dynamo Kiev winger Andriy Yarmolenko ahead of the English champions clash with the Ukrainians next week.
And Yarmolenko came alive at the start of the second period as he smashed a shot off the outside of the post.
Spain should have sealed all three points when Paco Alcacer was denied by Pyatov after brilliant skill by Isco and Thiago to set up the Valencia man and Nacho was penalised for a foul on Yarmolenko before Mikel San Jose smashed home the rebound.
However, De Gea had to come to his side's rescue again with brilliant saves from Garmash and Oleksandr Zinchenko's late volley to seal a frustrating night for the hosts.