The Super Eagles were heading out of the competition because of their disciplinary record until Moses, who won both spot-kicks, netted the first in the 79th minute.
And he repeated the trick in the 90th minute, scoring past midfielder Addis Hintsa after goalkeeper Sisay Bancha had been sent off for conceding the penalty. Ethiopia had already used all their substitutes.
The goals got Nigeria out of jail after they had dominated without managing to find a way past their opponents.
A goalless draw would have seen them eliminated on a fair play system, with holders Zambia the side set to profit.
Nigeria started brightly and Efe Ambrose headed over from a Moses free-kick after only two minutes.
Ethiopia came into the game bottom of the pool, but still in with a shout of going through.
And they threatened when Dawit Estifanos swung in a corner, which Saladin Said headed over.
But for the most part they were on the back foot and Ikechukwu Uche headed another Moses free-kick over the top, while Uwa Elderson Echiejile met another Moses ball in and brought a parry out of Sisay.
Nigeria had a golden chance to take the lead on the stroke of half-time when Kenneth Omeruo's shot fell kindly for Emmanuel Emenike in the area, but he blazed wildly over the bar.
The Nigeria fans were starting to lose patience with their side's failure to make the breakthrough, having seen them concede late equalisers in their previous two matches.
Godfrey Oboabona had a header cleared off the line and keeper Sisay needed two attempts to clutch a Sunday Mba shot before Moses finally calmed the nerves.
The Chelsea man was chopped down by Alula Girma as he broke into the area to win a penalty, which he placed coolly into the bottom right corner.
Ethiopia almost grabbed an equaliser only for Nigeria keeper Vincent Enyeama to pulled off a fine save from Saladin.
But Moses made sure of the points when he raced clear only to be sent flying by Sisay.
A penalty was the decision and the keeper shown a second yellow card.
Hintsa was finally handed the gloves, but Moses beat him easily from the spot, this time going low to the opposite left corner, to send Nigeria through.