Under a punishingly hot sun, Hamilton took the formerly tyre-shredding Mercedes to a win on a circuit expected to be hard on the Pirellis.
Mark Webber, too, made a spectacular comeback from his qualifying dramas with a near-faultless drive to take fourth place.
The Williams team could finally celebrate, as Pastor Maldonado brought his car home in tenth (with all its paint) for a point - their first in 2013.
Practice and Qualifying
Lewis Hamilton stormed to pole, pipping Red Bull's Vettel and Lotus' Romain Grosjean. Rosberg followed with Alonso fifth and Raikkonen sixth.
Webber's car let him down in qualifying, with neither KERS nor full-speed upshifts, but the Australian was heroic in Q2, setting the seventh fastest time. He didn't in Q3 however, leaving him tenth.
Daniel Ricciardo scored a hat-trick of Q3 appearances and set the eighth-fastest time ahead of Sergio Perez who was recovering from a heavy crash in FP3, out-qualifying teammate Button.
Under a baking Hungarian sun, the grid lined up at the twisty Hungaroring, attended by many fans from nearby Finland and Germany. As usual, there were murmurs about tyre life, especially from the Mercedes camp.
Hamilton got a good start and Vettel's luck off the grid continued as he managed to keep Grosjean at bay and hold second.
Rosberg took two excursions off the road while Mark Webber stayed out of trouble and gained a couple of places, going past Ricciardo. Button, too, jumped the Toro Rosso from his lowly start.
Ferrari's Fernando Alonso made progress, passing Rosberg around the outside before the German ended up being hit by Massa, causing his second trip off the track.
Hamilton pulled away from Vettel, leaving the reigning world champion to fall into the clutches of his first-lap sparring partner Romain Grosjean.
On lap seven, Webber, on the medium tyre, began to close on Raikkonen's Lotus, shod with the soft tyre, his engineer telling him he was the lead drive on the prime tyre.
Two laps later, Hamilton pitted, his soft tyres already ragged. Vettel took the lead as the Mercedes pit fitted mediums, dropping him behind former teammate Jenson Button. Meanwhile, Grosjean seemed unable to close the gap to Vettel, even with DRS.
Vettel came in the following lap to rid himself of the rapidly wearing soft tyres. The Red Bull driver lost out to both Hamilton and Button.
Alonso pitted on lap 13, the last of the true frontrunners to pit before either Lotus driver. Raikkonen complained of his rears giving up and Grosjean duly pitted on lap 14.
Raikkonen came in to the pits behind the exiting Grosjean, the Lotus team executing two perfect stops in thirty seconds, but Raikkonen still lost time.
These stops put Mark Webber in the lead and Grosjean in fifth behind Vettel. Vettel was having his own problems, his engineer asking him to pull out from behind Button's car to help cool the RB9.
Hamilton quickly dispensed with Button and set off after Webber.
Vettel was in no mood for lapping behind the McLaren and made a big dive on lap 17. The Briton left him room but Vettel's left front wheel locked and he believed his wing was damaged.
This allowed Grosjean to resume his enthusiastic attack as the Red Bull's KERS began to overheat.
Grosjean launched an all-out offensive on lap 19, getting a DRS-assisted tow down the main straight. He fired around the ducking Vettel, but was unable to pass on any of the next four corners, despite his best efforts.
Further back, Raikkonen got past Massa who got a little ragged and ran wide, allowing the Finn past into eighth.
Sutil was out of the race on lap 21 after an hydraulic failure in the pits, compounding the embarrassment of a bungled pit stop.
Vettel's car appeared to get its second wind and he again closed up on Button. The McLaren had three cars behind, including Alonso.
Webber pitted on lap 23 and took on another set of the favoured medium tyre and he rejoined behind Alonso in sixth.
Vettel forced his way past Button on lap 24, soon followed by Grosjean. The Lotus driver cut across the McLaren too early, unsettling the car.
Button pitted and took on soft tyres, his team clearing him of front wing damage. Grosjean pitted the following lap for new tyres, putting him directly in the path of the McLaren.
Grosjean was investigated and penalised, ruining by far his best performance of the year. The penalty, however, was for passing Massa around the outside at turn four on lap 29 and going off the track on the wide kerbs.
Hamilton led the race from Vettel by over 12 seconds on lap 30, a surprise to many considering the glum pre-race tyre talk.
Hamilton pitted on lap 32, coming out in fourth behind Mark Webber but ahead of Kimi Raikkonen. Massa came in too, having just been passed by Jenson Button.
Lewis Hamilton capitalised on Webber running wide at the end of lap 33. The Australian almost lost the car on the final turn and Hamilton fired past at turn three, straight on to the gearbox of Alonso.
On lap 35, Vettel appeared to be baulked by the Caterham of van de Garde on his way out of the pits.
Button didn't look twice and got past the Red Bull driver who was still complaining of front wing damage. Vettel came back at him under DRS a couple of laps later and took the pass.
Lap 42 saw Hamilton still leading Webber by over two seconds. Webber still had to use the soft tyre and Hamilton would have to switch to another set of medium tyres for a dash to the finish. Webber pitted on lap 44, putting him behind Vettel.
Raikkonen pitted from third on lap 43 in an effort to undercut Vettel who was yet to stop for a third time. The Lotus driver was having a patient race and looking after his tyres.
On lap 45, Valtteri Bottas pulled over with a heavily smoking car. The car was cleared under double-waved yellows, preventing the safety car taking to the track.
Grosean pitted on lap 47. A slow stop due to missing his marks cost him almost a second and once again he found himself dicing with Jenson Button, which proved to be entertaining for two laps before Grosjean passed cleanly.
Hamilton pitteed on lap 50 and came out alongside Mark Webber at turn one. Webber was trying to pass the slow-moving Sauber of Hulkenberg but Hamilton was able to go around the outside of them both.
Seventeen laps from the end, the podium was far from decided, with Vettel and Webber yet to stop and Raikkonen stretching his final set for an unlikely twenty-four laps.
Vettel pitted on lap 56 for the last time, allowing Kimi Raikkonen through and Hamilton into the lead. Webber pitted on lap 60 for an even ten laps on the rapid-wearing - but very grippy - soft tyres.
He came out ahead of Alonso while his teammate battled with the Lotus of Raikkonen.
Nico Rosberg's distinctly ordinary race finished on lap 66, with the right bank of the Mercedes V8 giving up in a plume of smoke and fire.
Vettel struggled to make inroads on Raikkonen as Webber began his chase of the battling Vettel and Raikkonen. Vettel launched an attack on lap 68 but Raikkonen was ready for it, wrong-footing the German who got straight on the radio to complain.
Somehow Kimi Raikkonen kept Vettel behind him all the way to the line for a spectacular second place. Raikkonen was instructed to pull over at the pit exit and even had the presence of mind to wish his team a good holiday.
Mark Webber came home fourth, his Red Bull team atoning for their qualifying disaster.
"I think we had the right strategy. We knew there was a lot of pressure on getting a good first lap and I got some clear air, which worked well."
Ricciardo faded to 13th.
"I tried my best in terms of trying to maintain a good pace and look after the tyres, but today it was not enough to go looking for points"
Hamilton was overjoyed with his win: "We really didn't expect this when we came here this weekend and I said last night that I would need a miracle to win today."
Formula 1 returns after the August break at the classic Spa Francorchamps for the Belgian Grand Prix.
- Lewis Hamilton - Mercedes - 1h42m29.445s
- Kimi Raikkonen - Lotus-Renault +10.938s
- Sebastian Vettel - Red Bull-Renault +12.459s
- Mark Webber - Red Bull-Renault +18.044s
- Fernando Alonso - Ferrari +31.411s
- Romain Grosjean - Lotus-Renault +52.295s*
- Jenson Button - McLaren-Mercedes +53.819s
- Felipe Massa - Ferrari +56.447s
- Sergio Perez - McLaren-Mercedes +1 lap
- Pastor Maldonado - Williams-Renault +1 lap
- Nico Hulkenberg - Sauber-Ferrari +1 lap
- Jean-Eric Vergne - Toro Rosso-Ferrari +1 lap
- Daniel Ricciardo - Toro Rosso-Ferrari +1 lap
- Giedo van der Garde Caterham-Renault +2 laps
- Charles Pic - Caterham-Renault +2 laps
- Jules Bianchi - Marussia-Cosworth +3 laps
- Max Chilton - Marussia-Cosworth +3 laps
- Paul di Resta - Force India-Mercedes +4 laps/DNF
- Nico Rosberg - Mercedes +6 laps/DNF
- Valtteri Bottas - Williams-Renault 42 laps
- Esteban Gutierrez - Sauber-Ferrari 28 laps
- Adrian Sutil - Force India-Mercedes 19 laps
- Interested in buying ? Visit our showroom for more information.