Lewis Hamilton finally achieved his first victory with Mercedes by taking a record-equalling fourth chequered flag in Hungary.

The 28-year-old Briton produced a masterful drive around the Hungaroring to follow up on his wins with McLaren in 2007, 2009 and last year.

This triumph, however, will taste extra sweet as he has been itching to get back to the top of the podium after watching team-mate Nico Rosberg win twice earlier this year.

Hamilton finished 10.9 seconds clear of Lotus' Kimi Raikkonen for his 22nd career win; the Finn holding off Red Bull's Sebastian Vettel over the closing laps to claim second.

Congratulations were radioed to Hamilton by team principal Ross Brawn, before Mercedes' non-executive chairman Niki Lauda added: "He won because he drove sensationally, the best I've ever seen him drive. We were not as quick as the Red Bull, but Lewis made it all up with the way he passed people. He was outstanding."

Hamilton's first duty was to hold on to his pole on the long run to the opening corner, which he did with comparative ease. Instead, it was Vettel who found himself under attack, from Lotus' Romain Grosjean to his left and Mercedes' Nico Rosberg to the right. Vettel just did enough to retain second place but German compatriot Rosberg twice ventured off the track on the opening lap.

The second occasion followed a collision with Felipe Massa, dropping him to 12th, before retiring five laps from home with a blown engine.

Mercedes, though, had finally managed to get their tyres right, and in the highest racing temperatures of the year. The mercury hit 35˚C, while the track itself was 50˚C, as it had been during qualifying.

Mercedes had apparently come into the race without much expectation, particularly after missing last week's young driver test in which the other 10 teams were allowed to get to grips with Pirelli's new tyres.

The high-speed blowouts of the British Grand Prix had led to the company marrying last year's construction and the 2013 compounds.

Mercedes had spent their three Hungaroring practice sessions trying to gain as much data as possible in a bid to extend their run of six pole positions in the previous seven races.

And Hamilton obliged, clinching his 30th career pole, and three in a row for the first time. Despite that, he remarked it would take a miracle for him to win, saying his tyres would "drop off a cliff", as they have often done in the heat this season.

Hamilton, who made his first pit stop after nine laps, passed former McLaren team-mate Jenson Button one lap later.

When Vettel pitted soon after he too came out behind Button, but found himself stuck behind the Briton for 12 laps – which probably proved crucial – until his tyres eventually deteriorated.

That was on lap 25, when Button was barged out of the way by Grosjean, resulting in a post-race stewards' investigation.

A second inquiry followed soon after for the Frenchman as he was found guilty of "leaving the track and gaining an advantage" in pulling off what initially appeared to be a superb move on Massa around the outside of turn four.

That ruined all hope of a potential maiden victory for Grosjean, who had to settle for fifth, which left Hamilton to manage the pit stops and his tyres, although there were two moments of consternation.

The first was when Williams' Valtteri Bottas retired on lap 45, his car parked close to the final turn, and with the marshals slow to clear there was a suggestion a safety car would appear.

Mercifully for Hamilton that did not happen, while neither did the engine blowout which took his team-mate out of the race in the closing stages.

Hamilton, who has equalled Michael Schumacher's feat of four wins at this track, moved to within 48 points of world champion Vettel. "It's an incredible feeling. My team did an incredible job," said Hamilton on the podium, as he took the acclaim of the crowd. "We studied things a lot last night and were hoping the tyres would last. We had no idea it would go that well.

"I was hungry for it today, I was going all out. Usually I get stuck in traffic, but today I was going for every move I could. For the last 20 laps it was then about managing the tyres, but this is one of the most important wins of my career.

"To win for Mercedes is a privilege. I really couldn't be happier. I just hope there is more to come. We've got to keep working hard and see how the tyres last elsewhere, but if we can come here and make them last anything is possible."

Behind the top three, Mark Webber was fourth in his Red Bull, with Ferrari's Fernando Alonso fifth, the Spaniard now 39 points adrift of Vettel and having fallen a point behind Raikkonen.

Grosjean was sixth, followed by Button, Massa, and the second McLaren of Sergio Perez, with Pastor Maldonado 10th, giving Williams their first point of the season.