The Hungarian Grand Prix proved to be an extraordinary race, one with an even more extraordinary result.

Consider that the winning team appeared to be in disarray on Friday, the driver who finished second had a 10s penalty, the man in third survived three collisions and had to stop for a new front wing, and the fourth-place finisher had to take a drive-through.

And fifth place went to a McLaren Honda, one that had not even completed a flying lap in Q2, and yet survived Sunday afternoon without a glitch.

Meanwhile, the man everybody expected to win was a humble sixth. Given that he had made a bad start, ran off the road on the first lap, survived a heavy collision, stopped for a new wing, and taken a drive-through penalty, Lewis Hamilton was actually quite relieved to end up with such a result – not least because he finished two spots ahead of title rival Nico Rosberg.

So how did we end up with such an unexpected result, and how did Sebastian Vettel and Ferrari pull off a victory?

With its low speeds and hot weather, Hungary was always going to be a track that mixed things up a bit, and potentially gave others a chance to challenge Mercedes.

From the start of the weekend Red Bull looked strong, but in contrast Ferrari struggled on Friday, and a myriad problems cost the team mileage.

“Before Friday we had our data, and we were reading the data, and we thought, 'OK in Hungary it could be a good race,” said team boss Maurizio Arrivabene. “Of course, we were not thinking to win the race, but at least to fight. Then everything happened on Friday, and on Saturday the first thought was, 'Guys, calm down, we need to do our analysis, to put everything together.'

“On Friday we were struggling a lot. I mean, at one stage James Allison said to me, 'Look, if I had to think about the worst day, today was the worst of my career.' But we put together everything, we were working with determination.

“They were using the FP3, and only the FP3, to try to adjust the car, and then after that Saturday evening they said, 'OK, we think that we are in a good way.' Not for sure thinking about this result, but at least to say we were in a good way.”

He makes it sound straightforward, but a lot of blood, sweat and tears went into honing the cars. Vettel earned third on the grid, and Kimi Raikkonen fifth, the Finn having lost more valuable track time in FP3 to a water leak.

Start the key

The key thing was that both men were on the odd numbered side of the grid, which in Hungary traditionally offers the chance to gain at least one spot on the man immediately ahead. But even Ferrari couldn't anticipate how things played out.

The start was of course the key to the race. Just as the Williams drivers swept past the Mercedes duo at Silverstone, so both Ferraris managed to do the same this time around. It wasn't just about the launch, as there was a fair bit of pure racecraft involved, especially in Raikkonen's case, as he went should to shoulder with Rosberg.

Both Mercedes drivers ran wide at Turn 2 in their desperate efforts to make amends, and then further around the lap Hamilton made his life even more difficult by jumping across the gravel trap.

Now it was game on for Ferrari. If you are in front you can control the race, and as we saw so often in his Red Bull days, one of Vettel's defining strengths is his ability to drive a perfect race if he's in clean air and can pace himself. And that's what he did on Sunday.

"It's true that when you start as we started today, in the open air, the car is giving to you more chance," said Arrivabene.

"And the guys in the back, the consumption of the tyres is quite high. But by the way, it's happened some times that we're on the back, and our consumption is higher. Today we were on the front, and it was OK..."

"It makes a difference if you find yourself in clean air, dictating the pace rather than following the top two cars," said Vettel.

"In some races we didn't really see them for long. In other races we were sort of stuck behind them and you cannot really show your true pace so I think - especially in the beginning of the race, but then again, I think the whole race – the pace was really really good."

Vettel was helped by having Raikkonen riding shotgun, and by the fact that Rosberg, for reasons which neither he nor the team could fully explain, struggled for pace on the soft tyre.

The lack of an immediate threat from Rosberg, and the fact that Hamilton had to claw his way up from as low as 10th position, meant that Vettel and Ferrari could run their own race, wait until the others had stopped, and play out an optimum strategy.

Safety car close call

It could have gone awry when Nico Hulkenberg's crash triggered a Virtual Safety Car. Vettel took advantage to pit for the medium tyres, and had it remained a VSC, he would have retained the advantage he'd built up.

But it soon morphed into a full safety car, and thus the gap disappeared. On lap 41, just before the Hulkenberg shunt, he had been 13s ahead of Raikkonen – fading as an ERS failure kicked in – and a huge 27s clear of Rosberg, whose pace had been even less convincing on the mediums he took for the middle stint.

All that was now gone. As the green flag flew for the restart Vettel had just Raikkonen protecting him from Rosberg, who immediately blew past the Finn. We might have expected to then see Rosberg, picking up his pace on the soft tyres having taken the pain of the mediums in that middle stint, harassing the leader, who had no choice but to go to mediums for the run to the flag.

But to the surprise of many observers, Rosberg was back on mediums for that final stint (more of that later). We'll never know if he would have found more performance on the softs – his first stint was not that stunning remember – but on the mediums he could just about match Vettel, but no more.

In turn he had to keep his eyes on his mirrors, which were full of an irrepressible Daniel Ricciardo, the only member of the leading trio who was on the softs, and fresh ones at that.

Vettel had to work hard in that final stint, but he did his job to perfection. For lap after lap he stayed out of DRS range – 1.2s, 1.4s, 1.2s at the startline – and only once, on lap 53, did the gap dip down to 0.8s. Then with just under seven laps to go Rosberg and Ricciardo tangled, and the pressure was off Vettel.

He didn't slacken his pace, as Daniil Kvyat was close enough to keep him on his toes, albeit with a 10s penalty hanging over him, and thus Vettel kept banging in quick laps. He wasn't exactly about to let Kvyat catch up and pass and take the chequered flag first, although that could have happened! Vettel's team radio comments after the flag showed just what the win meant to him.

It was a superb performance, and one of which his old mentor and pal Michael Schumacher would have been proud – winning on a weekend when the odds appeared to be stacked against him. The downside for Ferrari was Kimi's ERS failure, a rare sign of mechanical trouble for the Maranello team.

Red Bull's step forward

RBR's stunning form meanwhile underlined just how Hungary shifts the emphasis from the power unit to the whole package. There were positive signs in Silverstone already, and this time the car seemed to be hooked up from the start of the weekend, and both drivers gained confidence, something that was very evident in the race.

"We knew that this track would play to some of our strengths," said Christian Horner. "And it is great that we managed to capitalise on that with a double podium, with Dany Kvyat's first podium, Daniel Ricciardo's first podium of the year. it was great team performance and I think that this type of circuit with lack of dependency on straightline speed has played to our strengths."

Ricciardo in particular was on the sort of charging form that saw him gain three opportunistic wins last year, and the fact that he made it to the podium after three separate collisions was a reminder that he's a real racer – going around the outside of Hamilton at the restart was pretty clear evidence of that.

The great unknown is what might have happened had he found a way past Rosberg and given himself a few laps with which to tackle Vettel.

"It felt a little bit like deja vu from last year," said Horner. "We strategically made the call at the first stop to put the hard tyre on, we felt our only possibilities would be in the later part of the race if there were a safety car. And sure enough we had that set of tyres left, the safety car came out and it teed it up beautifully.

"Kimi had an issue, so Daniel made his way past Kimi fairly easily and managed to find his way past Lewis. There was quite a big contact, which damaged the car quite significantly, but despite that he was able to close in on the leading pair and he was always going to have a go, and obviously got a run up the inside, got in a bit too deep and Nico came across his bows on the exit and it looked like a racing incident. It is a shame without that, if he had managed to get pass Nico it would have set up an interesting finish with Seb."

What went wrong for Mercedes

So what of Mercedes? On the face of it was a disastrous afternoon for the drivers and team, but they still both scored points, and Hamilton's main concern was that he logged four more than his title rival.

Hamilton made no excuses afterwards, admitting that he'd made mistake after mistake, and he must now be hoping that he's used up his quota for the season in one afternoon.

This was definitely not a good weekend for Rosberg, who lost out to Lewis by almost 0.6s in qualifying and then found himself struggling for pace on Sunday. He also got a lot of flak for the seemingly conservative decision to go with the medium tyre for the final stint.

Earlier we'd heard a team radio conversation which indicated that he simply wanted to mirror what Hamilton was doing on the basis that he could stay safely ahead, and wouldn't be caught out by the softs fading in the latter stages.

However, Toto Wolff insisted that ultimately the responsibility for that choice was the team's.

The Virtual Safety Car came out when Rosberg was approaching the last corner, and he ducked straight into the pits – the tyres that were ready and waiting for emergency use, the "default" tyres, were the mediums, based on the number of laps to the flag.

One lap later, and the shorter final stint length would have seen mediums wheeled away and softs put in their place. And had Rosberg been a corner further back when the VSC call was made, the team would have had time to make that last minute switch anyway.

"It was one corner," Wolff told Motorsport.com. "They were in the second last corner when the Virtual Safety Car was deployed, one corner earlier, the default tyre would have been changed from medium to soft. The medium tyre was sitting there, the Virtual Safety Car was deployed, he got the call, he came in, the medium tyre wasn't there."

It could be argued that Mercedes reacted too quickly to the VSC. If there was some doubt about tyre choice, why not let Rosberg run another lap? With a VSC lap taking around 90 seconds that would have provided plenty of time to chat with the driver and make a more considered call.

After all, plenty of drivers pitted on subsequent VSC laps without suffering any harm, as by definition the gaps are maintained.

It would perhaps be unfair to suggest that after Monaco this is the second time that Mercedes hasn't quite got it right under a VSC, and the team would probably say that the risk in not coming in immediately is that a VSC could turn into a proper safety car – which is what eventually happened – and that could complicate matters.

Meanwhile, Wolff insisted that the tyre choice definitely wasn't a case of Rosberg wanting to cover Hamilton's strategy: "Earlier, before, but not in that situation."

Nevertheless the damage has been done in that many observers thought Rosberg's radio comment showed a little too much focus on his teammate, when perhaps he should have been looking more at the fight ahead and trying to win the race.

Hamilton's remark when he went off track on lap one also told its own story: "Nico crossed over my line there, pushed me wide..."

It's no great surprise that these two remain resolutely focussed on each other, but they could do well to take a look at the world championship table, which shows Vettel just 42 points behind Hamilton, and only 21 behind Rosberg.

It's a long shot given the overall picture of pure performance, but history relates that sometimes battling teammates are pipped at the line by someone they didn't see coming up on the rails.

It happened for example with Alain Prost vs Williams in 1986, and again with Kimi vs McLaren in 2007. This season could still have a few twists and turns.