Andriy Shevchenko's unbeaten side are through to next summer's finals with a match to spare as Group B winners thanks to first-half goals from Roman Yaremchuk and Andriy Yarmolenko, which meant that Ronaldo's 72nd-minute penalty wasn't enough for Portugal.
Ukraine join Poland, Russia, Italy and Belgium in the multi-host tournament which kicks off in Rome on June 12, with Shevchenko -- who scored 48 times for Ukraine in 111 matches -- proving a similar success on the bench as he was on the pitch.
Second-placed Portugal's fate is still in the balance, with Serbia just a point behind them with two matches remaining after they beat Lithuania 2-1.
Portugal dominated the second half and finally achieved a breakthrough when Stepanenko blocked a shot with his arm, receiving his marching orders before Ronaldo blasted home the penalty to make it 700 goals for club and country.
Group A leaders England still have to wait for the place at the Euros after hammering hapless Bulgaria, but the focus of attention was again on the stands as the home fans caused mayhem with racist chanting that twice caused the match to be halted.
It was another England match blighted by racism from opposition fans after England's black players were targeted with monkey chants during their 5-1 win at Montenegro in March.
Racism blights England win
The level of abuse from a section of the Bulgarian support led the English Football Association to demand an investigation from UEFA, asking European football's governing body to open a probe "as a matter of urgency".
"We know it is an unacceptable situation," Southgate told British broadcaster ITV.
"I think we've managed to make two statements really by winning the game, but also we have raised the awareness of everybody to the situation.
"The game was stopped twice and I know for some people that won't be enough, but I think we were as a group on board with that process."
England led 2-0 through early goals from Marcus Rashford and Ross Barkley when play was first stopped and an announcement made to supporters that the game could be suspended the abuse continued.
Once restarted, England quickly made it 3-0 through Barkley before a second stoppage, with Croatian referee Ivan Bebek holding discussions with players and coaching staff from both sides.
Raheem Sterling then netted twice either side of half-time before Harry Kane rounded off the scoring to take England to the brink of qualification.
Gareth Southgate's men have now scored 26 goals in 6 qualifying matches and are four point ahead of third-placed Kosovo with two matches to play.
However third-placed Kosovo's 2-0 win over Montenegro means England need a win from one of their remaining two matches to ensure qualification.
Ayhan denies France
France also missed a spot in the Euros when Kaan Ayhan's leveller snatched a point for Turkey in a match played against a backdrop of diplomatic tensions after Paris condemned Ankara for its military offensive against Kurdish forces in Syria.
Substitute Olivier Giroud headed France in front on 76 minutes at the Stade de France. Ayhan nodded home six minutes -- and celebrated with a military salute in front of the Turkish supporters -- to leave Didier Deschamps side waiting.
"We did what we needed to win the match based on the play and number of chances. They didn't have many but put away a set-piece," said Deschamps, whose team lost 2-0 by Turkey in Konya in June.
"We should have been more clinical even if it's still a good point," he added. "We're still on track and need to finish to job in November."
Turkey remain top of Group H above the world champions on the head-to-head rule. Although France can qualify for the finals with a win at home to Moldova next month, Turkey would clinch their place by avoiding defeat against third-placed Iceland, who are four points back after beating Andorra 2-0.