After five consecutive clean sheets, Northern Ireland almost conceded after five minutes when Liverpool's Dominik Szoboszlai struck the woodwork.
Goalkeeper Pierce Charles gave away possession and the ball was squared across the box by Bendeguz Bolla but, from a narrowing angle, the Hungary skipper struck the base of the post with Charles beaten.
The goalkeeper's older brother, midfielder Shea Charles, then had to be alert to cut out a Szoboszlai pull-back as the pressure built on the visitors.
With just 29% possession in the first half, and in the absence of suspended striker Jamie Donley, Northern Ireland struggled to make attacking inroads, but did have an excellent chance to open the scoring from a set-piece.
A long throw-in from Ciaron Brown was headed on by Ruairi McConville to Tom Atcheson, but the Blackburn man, who scored with a brilliant flick against Guinea on his his first international start in June, did not get the right connection this time around.
For all Hungary's dominance in possession, their opening goal came on the counter-attack when Northern Ireland piled forward for a corner only for Barnabas Varga to latch on to a ball that Trai Hume could not clear and slide his finish beyond Charles in the visiting goal.
While Northern Ireland players protested, a video assistant referee (VAR) check for a penalty at the other end came to nothing.
Striker Josh Magennis came on at half-time, with Kelly reverting to a more familiar midfield role until replaced 10 minutes later by Kieran Morrison, and Hume dropping into defence.
Target man Magennis quickly showed his differing skillset, providing the knock-down for Isaac Price before the West Bromwich man rattled the post from outside the box.
Magennis' fellow substitute Morrison made an impact down the left too and the equaliser came 20 minutes into the half when a long throw from Hume was flicked on by Brown, flicked up by Devenny and then hammered into the top corner by the Stoke City man.
Andras Schafer had the best chance for the hosts to retake the lead and secure promotion for themselves but the Union Berlin midfielder could not direct a back-post header on target from Milos Kerkez's deep cross.
Szoboszlai lashed over in the late stages, while substitute Rajmund Toth did likewise in added time after the ball fell invitingly in the box, but Northern Ireland held firm to spark huge celebrations among the squad in front of over 2,000 travelling fans in Budapest.