The Zaragoza striker struck to spare Paulo Bento's blushes after a battling display from the Green and White Army looked to have earned a shock victory
Michael O'Neill's side travelled to Porto with eight players out injured and Gareth McAuley suspended, but took the lead after half an hour through McGinn as Portugal were caught napping at the back.
The home side rallied and spent the rest of the encounter attacking, but never looked too likely to score as Ronaldo floundered and their defence looked increasingly shaky.
They did start well, however, and Miguel Lopes, who replaced Fabio Coentrao in the starting line-up, flashed a shot just wide of the far post after two minutes, while Ronaldo dragged one wide of the other upright four minutes later.
The visitors forced three corners in the first 15 minutes as the home defence endured a shaky opening, but O'Neill's men could not make the most of their opportunities.
But they came back through Oliver Norwood, who sent a 25-yard free kick down the throat of Seleccao goalkeeper Rui Patricio, while at the other end Roy Carroll tipped Nani's dipping header over the crossbar.
Northern Ireland had been adventurous all night - especially considering their understrength line-up - and their positive outlook paid off when Jonny Evans won the ball in his own half, burst forward and picked out Kyle Lafferty. The Sion forward advanced on the home defence before picking out McGinn, who was completely free on the left after outpacing Joao Pereira, to take a touch and fire over Patricio to record his first competitive goal for the Green and White Army.
But the visitors had to ride their luck in the aftermath of the goal, with Aaron Hughes almost heading into his own net before Craig Cathcart crashed Pereira's cross past Roy Carroll, only to see the ball come back off the crossbar.
Portugal poured forward and Pereira's shoot drifted wide of the far post, but the visitors continued to look solid at the back, which is more than could be said for Paulo Bento's men.
Ronaldo had a 30-yard effort blocked by the imperious Jonny Evans, but went closer after 58 minutes when his half-volley from around the penalty spot was saved smartly by Carroll.
Carroll did well to keep out a long-range effort from half-time substitute Ruben Amorim, and moments later Steven Davis almost sliced Pepe's weak cross over his own goalkeeper.
Ronaldo went close again with 20 minutes on the clock, but Hughes was on hand to get in a timely block as the Real Madrid forward set his sights on the elusive equaliser.
Postiga fired a shot straight down the throat of Carroll on 76 minutes, before stretching the keeper again three minutes later.
But the Zaragoza striker went one better seconds afterwards when the ball fell to him inside the six-yard box. After Nani failed to make proper contact with Bruno Alves' header, Postiga brought it down, swivelled and stroked in the equaliser to the sheer delight of the home fans.
Bento's men came forward again and Silvestre Varela lashed a shot into the side netting, before Nani's dipping effort flew inches over the crossbar.
With five minutes of stoppages added on, Eder thought he had won it only for Jonny Evans to get across and divert the danger at the last minute.
That was to be the last chance of note for either side, and although the visitors will be disappointed to have conceded a late equaliser, they should be proud of their organised, determined display.
It has been a disastrous couple of games for Portugal, however. Following defeat against Russia on Friday, they have taken just one point from two games and they now have a big job on their hands to make it to Brazil 2014.