Defender McAuley outjumped full back Yevhen Khacheridi to meet Oliver Norwood’s free kick early in the second half, shortly before a ferocious hailstorm forced a brief interruption.
Substitute McGinn added the second in the 96th minute — the latest goal to be recorded in a Euro finals match in regular time — after keeper Andriy Pyatov could only parry a shot from Stuart Dallas.
McGinn was the ninth substitute to score in the first 17 games of a tournament where injury-time goals have been coming thick and fast.
The result leaves Ukraine without a point in Group C but means Northern Ireland now have three, and a chance of reaching the last 16, as they brace themselves for a daunting final match against world champions Germany on Tuesday.
It was Northern Ireland’s first win at a major championship finals since they famously defeated hosts Spain in the 1982 World Cup.
“Lots of people said we wouldn’t get a point here and we’ve now got three,” said man-of-the-match McAuley, 36, who became the second oldest player to score in the Euro finals after Austria’s Ivica Vastic.
“We’ve got a tough game to look forward to now and we’ve got something to play for … that’s what we wanted.”
Ukraine midfielder Taras Stepanenko said: “It’s clear it was a do-or-die game today and it seems clear we’re out of the tournament. If we look at the work rate it seems Northern Ireland wanted to win more than we did”.
GAMBLE PAYS OFF
Coach Michael O’Neill was rewarded in his gamble of making five changes from the side that lost 1-0 to Poland in the opening game, including bringing in striker Conor Washington to replace Kyle Lafferty, the team’s top scorer in the qualifiers.
While Ukraine enjoyed two-thirds of the possession in the first half, Northern Ireland had more efforts on target, the best being a stinging shot from a narrow angle from captain Steven Davis.
For Ukraine, Serhiy Sydorchuk fired a shot over the bar from a failed clearance.
While winger Yevhen Konoplyanka stretched the Irish defence with some tricky runs, the Ukrainians were largely restricted to long-range attempts on goal.
Yaroslav Rakitskiy had one such effort comfortably saved by keeper Michael McGovern and Konoplyanka hit a free kick over the bar from more than 30 metres.
The game opened up after McAuley’s goal soon after the break and Sydorchuk had a header saved from a corner.
When the players returned after the game was halted for two minutes because of the brief hailstorm, Viktor Kovalenko fired a shot just wide from the edge of the penalty area and a second from similar range minutes later.
Substitute Olexandr Zinchenko rose above the defence but headed straight at McGovern and soon afterwards the keeper dived to his left to save a long-range left-footed effort from Andriy Yarmolenko.
Ukraine again dominated possession throughout the half, but left themselves open as they strained for the equaliser, and McGinn was there at the death to seal the victory, his goal being timed at 95 minutes 52 seconds.
Irish celebrations, though, fell terribly flat later when news emerged that one of their supporters had collapsed and died during the game.
The Police Service of Northern Ireland (PSNI) said the man, in his 60s, was treated by paramedics but could not be revived.
He was the second Northern Ireland fan to die during the tournament after Darren Rodgers, from Ballymena, fell to his death in an accident in Nice.