Backed by a raucous capacity home crowd, Hungary started aggressively by getting into the faces of the world champions, but Didier Deschamps side soon found their rhythm.
France dominated the ball as Kylian Mbappe headed over from a superb Lucas Dinge cross, the Everton man brought into the side for Lucas Hernandez in the only change from their opening win over Germany.
Mbappe was involved again minutes later when France should have taken the lead. The PSG forward wonderfully collected a ball from Antoine Griezmann and flicked into the path of Karim Benzema, but the returning striker somehow managed to skew wide.
France were getting closer to a goal, though, as Paul Pogba then struck the side netting.
It looked to be a matter of course that the visitors would open the scoring, until Hungary delivered a sucker punch in added time at the end of the first half.
Attila Fiola played a sharp one two and raced in behind Benjamin Pavard and Raphael Varane before poking past Hugo Lloris at the near post and lifting the roof off the Puskas Arena. France were rocked and raging. Having dominated but failed to open real gaps they were behind.
Hungary continued to hold firm in the second half before Deschamps sent on Ousmane Dembele, who picked up the pace and quickly struck a post.
After all the attempts to play cute football and find a way through, route one brought France level.
Mbappe ran onto a long ball from Lloris and managed to bring the ball down in behind the Hungarian back line before cutting back for Griezmann who buried the chance.
Oliver Giroud was then sent on for an underwhelming Benzema to find a winner and a way into the knockout stages. The Chelsea striker managed to nudged the ball to Mbappe but the 22-year-old found Peter Gulacsi in his path with a fine stop.