Match ends, Northern Ireland 1, Hungary 1.
Kyle Lafferty saved Northern Ireland from a damaging Euro 2016 defeat with a stoppage-time goal against Hungary.
The home side could have qualified for their first major tournament in 30 years with a win but fell behind when Richard Guzmics prodded home from goalkeeper Michael McGovern's mistake.
Chris Baird was then sent off for two rapid yellow card offences before Lafferty smashed home.
Two points from games against Greece and Finland will seal qualification.
The part-renovated Windsor Park was rocking throughout as an expectant home crowd hoped to see Northern Ireland reach a major finals for the first time since the 1986 World Cup in Mexico.
But, despite a dominant first-half display, a horrible lapse in judgement from Hamilton keeper McGovern looked like leaving the hosts in a nervous second place in Group F, just a point above Hungary.
McGovern failed to hold a straightforward free-kick from Balazs Dzsudzsak, allowing Guzmics to tap in.
With defeat looking inevitable, Lafferty snapped up his seventh goal of the Group F campaign to equalise when Gabor Kiraly could not hold substitute Niall McGinn's low drive to put qualification back in Northern Ireland's own hands.
Striker Lafferty, defender Conor McLaughlin and Baird will be suspended for the 8 October visit of Greece.
- How the match unfolded
- Radio highlights from a dramatic night at Windsor Park
- Podcast: 5 live Football Daily, including reaction from Belfast
Baird red-card controversy
Northern Ireland were already a goal down when the dismissal of Baird in the 81st minute provided a big talking point at Windsor Park.
Referee Cuneyt Cakir showed Baird two yellow cards, one after the other, before sending him off, to the confusion and anger of many home players.
Northern Ireland felt he should have only been booked once, but the referee indicated he was cautioning Baird for two fouls in the same move after playing an advantage.
Manager Michael O'Neill was left baffled by the decision of the Turkish official.
"Chris would not have made the second tackle if he knew he was being booked for the first," he said.
"I've never seen that before in a game in all my life."
From outcast to folk hero
In the circumstances, O'Neill will be hugely relieved to get a point from the match.
If Lafferty had not scored his dramatic stoppage-time equaliser, Northern Ireland might have been left needing to win their last two games against Greece and Finland.
Instead a single win, or two draws, will be enough to secure a top-two place in Group F thanks to a now superior head-to-head record with Hungary, who they beat 2-1 in Budapest a year ago.
Lafferty remains frozen out of the picture at club side Norwich - whom he has not played for since January.
However, only Bayern Munich duo Robert Lewandowski (10 for Poland) and Thomas Muller (eight for Germany) have more Euro 2016 qualification goals than the 27-year-old.
Man of the match - Kyle Lafferty
With no real stand-out performances, Kyle Lafferty gets the vote for his precious, point-saving goal. The striker has not been able to get a game with Norwich this season but has been a revelation for his country. the only blot was the booking which sees him pick up a one-game ban.
What next for O'Neill's side?
Northern Ireland next host Greece in Belfast on 8 October, before ending their campaign in Finland three days later.
A win in either match would book a place at the finals in France next summer.
Stats you need to know
- Northern Ireland have never reached the final stages of a European Championship
- Hungary conceded a goal for the first time in six Euro qualifiers
- Northern Ireland are the leading scorers in Group F with 12 goals - Kyle Lafferty with seven of them
- The match was played on the 10th anniversary of NI's famous Windsor Park win over Sven-Goran Eriksson's England
- 2McLaughlinBooked at 72mins
- 13EvansSubstituted forMcGinnat 56'minutes
- 6BairdBooked at 81mins
- 16NorwoodSubstituted forMagennisat 75'minutes
- 14DallasSubstituted forFergusonat 84'minutes
- 10LaffertyBooked at 10mins
- 20GuzmicsBooked at 19mins
- 3de AlmeidaBooked at 41mins
- 6ElekSubstituted forNagyat 23'minutes
- 11NémethBooked at 89minsSubstituted forVanczakat 89'minutes
- 9SzalaiSubstituted forPriskinat 68'minutesBooked at 84mins
- Cüneyt Çakir
- Shots on Target
Second Half ends, Northern Ireland 1, Hungary 1.
Goal! Northern Ireland 1, Hungary 1. Kyle Lafferty (Northern Ireland) left footed shot from the left side of the six yard box to the top left corner following a corner.
Attempt saved. Niall McGinn (Northern Ireland) right footed shot from outside the box is saved in the bottom left corner. Assisted by Steven Davis with a cross.
Corner, Northern Ireland. Conceded by Leandro.
Foul by Zsolt Kalmár (Hungary).
Conor McLaughlin (Northern Ireland) wins a free kick in the defensive half.
Foul by Tamas Priskin (Hungary).
Jonny Evans (Northern Ireland) wins a free kick in the defensive half.
Substitution, Hungary. Vilmos Vanczak replaces Krisztian Németh.
Krisztian Németh (Hungary) is shown the yellow card.
Tamas Priskin (Hungary) is shown the yellow card for a bad foul.
Foul by Tamas Priskin (Hungary).
Kyle Lafferty (Northern Ireland) wins a free kick in the attacking half.
Foul by Adam Nagy (Hungary).
Gareth McAuley (Northern Ireland) wins a free kick in the defensive half.
Substitution, Northern Ireland. Shane Ferguson replaces Stuart Dallas.
Second yellow card to Chris Baird (Northern Ireland) for a bad foul.
Chris Baird (Northern Ireland) is shown the yellow card.
Zsolt Kalmár (Hungary) wins a free kick in the attacking half.