Yamaha's Fabio Quartararo completed the podium and Australian Jack Miller was one of four riders who fell during the race.
There was an element of relief in the words of Hamilton who had to be at his very best to win the race.
The German driver won the 28-lap 'sprint' race for Prema Racing after starting from pole position in a reverse grid race. He had finished eighth in Saturday’s full-length feature race.
In doing so, he became the 100th different pole sitter in Formula One, doing so at the same Hungaroring track where his father Jos had claimed his first podium for Benetton 25 years earlier in 1994.
The defending five-time champion resumed normal service with a best lap in one minute 17.233 seconds on a challenging morning at the Hungaroring.
Spaniard Santiago Navarro claimed outright victory over Russian Aleksandr Dorosinskiy by the margin of just five seconds with Spanish former enduro rider Gerard Farrés in third place.
The 21-year-old Dutchman secured his second win of the season and seventh of his career, finishing ahead of four-time world champion Vettel, who had started 20th and last on the grid.
The Moneqasque will start 10th, 10 places ahead of his luckless Ferrari team-mate Sebastian Vettel who was unable to take part in qualifying due to a turbo problem and will start at the back of the grid for his home race.
The stage time put the Qatari and French co-driver Jean-Michel Polato just 37 seconds behind the stage-winning Russian Aleksandr Dorosinskiy with Spain’s Gerard Farrés and Santiago Navarro rounding off the top three.
Hamilton and team-mate Valtteri Bottas blamed the record-breaking European heat wave as Mercedes finished behind Ferrari ahead of this weekend's German Grand Prix.
The defending five-time world champion, and current series leader, told reporters Thursday that he was hoping for rain and admitted that if the sweltering conditions continued Mercedes would be in trouble.
Verstappen is behind the two Mercedes men, with defending five-time champion Lewis Hamilton on top 31 points ahead of Valtteri Bottas.
Adel and French co-driver Jean-Michel Polato currently hold equal third position in the FIA T3 category with Spaniard Santiago Navarro.
Al Attiyah secured a winning margin of 1hr 25min 04sec with a ninth successive stage win.
Al Attiyah and co-driver Mathieu Baumel now have a 70-minute advantage in the overall standings