The Bundesliga player, Baumgartner turned in David Alaba's corner on 21 minutes in Bucharest as Austria pipped Ukraine to second place in Group C behind the Netherlands.
Austria will play Italy at Wembley on June 26 after advancing from the group stage at a major tournament for the first time since the 1982 World Cup.
Ukraine, eliminated in the group stage at the past two European Championships, must wait to find out if they advance as one of four best third-placed teams.
Andriy Shevchenko had ruled out his Ukraine team playing for the draw they needed to finish as runners-up, having snapped a run of six straight losses at the competition with their 2-1 win over North Macedonia.
Austria coach Franco Foda recalled Marko Arnautovic after the forward missed the 2-0 defeat by the Netherlands while serving a one-match ban for insulting a North Macedonia player in their opening game.
Needing victory to be assured of a place in the next round, Austria went ahead as Baumgartner beat 18-year-old defender Illia Zabarnyi to Alaba's corner and poked beyond Georgiy Bushchan.
Ukraine came close to an equaliser when Mykola Shaparenko drew a good low save from Daniel Bachmann, the rebound just eluding a lunging Andriy Yarmolenko, who had scored in the first two group games.
Baumgartner's evening ended prematurely due to injury and his replacement Alessandro Schopf soon set up Arnautovic, the former Stoke man dribbling wide moments after Konrad Laimer's curling effort was punched away by Bushchan.
Austria nearly handed Ukraine a way back into the match when Stefan Lainer headed Viktor Tsygankov's free-kick towards his own goal, but Bachmann reacted well to preserve the victory and a spot in the knockout phase