A disbelieving Lewis Hamilton claimed he was robbed of a slam-dunk victory in Australia after a ruinous mistake by his own Mercedes team gift-wrapped the opening race of the year to Sebastian Vettel.
Defending champion Hamilton was cruising to the chequered flag at Melbourne's Albert Park after winning the dash to the opening bend and sustaining a comfortable lead over the chasing pack.
But Formula One's curtain raiser turned on its head in the space of a dramatic few minutes after Hamilton was leapfrogged by Vettel following the deployment of a virtual safety car (VSC).
Hamilton's Mercedes team calculated that the Briton, who unlike Vettel had already made his single stop for tyres, would re-take the lead in the case of a VSC period.
But when the VSC - in which the drivers have to run at a restricted speed - was deployed after Romain Grosjean stopped in a dangerous position, it prevailed that Mercedes had got their maths wrong.
Vettel was the fortunate recipient of their costly error as he made his stop for new rubber before staying ahead of a stunned Hamilton by just half-a-second.
"It was disbelief from that moment until the end of the race," said Hamilton.
"I did everything I believed I was supposed to do.
"In the race, I had extra tools so I could have been further ahead by the first pit stop, and I could have been further ahead after it. There were so many good things we could have done.
"It is a team effort but when you are relying on computers, on data, and on so much technology for the right strategy, I wish it was more in my own hands.
"It is obviously never easy to lose a grand prix, and we still got second, but it feels like a dark cloud."
Vettel was 11.3 seconds ahead when he stopped for tyres on lap 26, and Mercedes believed they had enough time in their pocket to ensure Hamilton would move back ahead.
"The software or system we have been using for five years just gave us the wrong number," Hamilton's Mercedes boss Toto Wolff explained.
"Lewis did nothing wrong. It was down to a software bug or an algorithm that was simply wrong."
Vettel played down his war of words with Lewis Hamilton after he snatched victory from his rival.
Hamilton goaded the Ferrari driver on Saturday after declaring he had wiped the smile off Vettel's face by storming to pole position at Melbourne's Albert Park.
But it was Vettel who ended up having the last laugh after a miscalculation by Hamilton's Mercedes team afforded the German victory in the first round of the new Formula One campaign.
Hamilton and Vettel clashed when they banged wheels at the Azerbaijan Grand Prix last year, but their rivalry has largely been a cordial one.
"Lewis said he was joking and I believe him," Vettel said in response to Hamilton's jibe after qualifying.
"We are old enough and we don't need to go on that sort of level.
"Apart from one point last year, we have not had a problem with each other. Even if we are very different people, we share a common passion and that makes us equal again.
"We love racing and we try to do our best, and in that regard, I do not see why we shouldn't get on with each other."
Vettel appeared to have his work cut out to stop Hamilton from winning the opening race of the year, but a virtual safety car period, coupled with a mathematical mistake by Mercedes, played into his hands.
The 30-year-old spent the first phase of the race behind both Hamilton and his Ferrari team-mate Kimi Raikkonen, but remarkably leaves Melbourne with his second win here in as many years.
"We got a bit lucky with the safety car," Vettel added.
"Obviously I was praying for a safety car, and there was a car that stopped at Turn 4. I was like 'no, the safety car is not coming out' and then somebody else stopped, and when I saw the virtual safety car I was full of adrenaline.
"They told me it was really close with Lewis, and when we got out ahead of him I knew it was difficult to pass but he kept some pressure on.
"Lewis had a great lap yesterday, and he deserved pole position. He drove a very good race, controlled it in the beginning, and , as I say, we got a bit lucky, but we'll take it."
The opening race of the new season at a sun-drenched Melbourne was passing off without incident, but a double retirement of both the Haas cars within three laps dramatically changed the course of proceedings.
Kevin Magnussen, running in fourth, fell first after his crew failed to secure his rear-left tyre at a pit stop. Grosjean then retired with a loose wheel following another mistake from the American outfit in the pits.
His stoppage led to the deployment of the VSC, and Vettel gaining the lead. The safety car was then issued to aid the recovery of Grosjean's stricken Haas.
Hamilton got to within half-a-second of Vettel once the race resumed, but ran off the track in his pursuit before eventually giving up the ghost.
"I was hungry to try and recover, and I was risking it all," Hamilton added. "I could have lost all the points.
"But eventually I had to make a sensible choice. There is a long, long way to go in this championship and all is not won in one race."
Kimi Raikkonen held off home favourite Daniel Ricciardo to secure the final podium position, while Fernando Alonso crossed the line an encouraging fifth for McLaren. Max Verstappen, who spun in the early stages, finished an underwhelming sixth.