Charles Leclerc won a close battle with Red Bull's Max Verstappen before taking a classy victory as Ferrari took a one-two in a dramatic season-opening Bahrain Grand Prix.
Leclerc and Verstappen staged a thrilling wheel-to-wheel dice after their first pit stops, swapping places five times in two laps before Leclerc moved ahead.
The closing laps were packed with drama, with a safety car period and then reliability problems forcing Verstappen's retirement promoting Carlos Sainz to second.
And then the second Red Bull of Sergio Perez suffered a failure at the first corner of the final lap leaving Lewis Hamilton to take the final podium place for Mercedes.
Hamilton had looked set for fifth place as Mercedes' pace problems became ever clearer during the race but Red Bull's nightmare provided the seven-time champion an unexpected boost.
The irony that Hamilton gained from Red Bull's misfortune in the first race after he lost the world title in the controversial climax to last season will be lost on few.
Leclerc's victory was out of the top drawer and underlined his quality as one of the leading lights of the new generation.
And if Ferrari can stay competitive throughout this long, 23-race season, he will be a serious contender for the championship.
What happened to Red Bull?
Verstappen should have taken second place but he suffered as Red Bull's day imploded in the final three laps.
The Dutchman tried his best, fighting vigorously with Leclerc after their first pit stops but ultimately losing out in the fight, and was looking set for a frustrated second place before his race unravelled.
He had already started to complain about heavy steering, and then a lap into the final sprint after the safety car he asked what was happening with the battery. He slowed and pulled into the pits with three laps to go.
Sainz moved into second and Perez was left holding off Hamilton for third place.
The Mexican was also suffering problems but was managing to keep Hamilton just at bay when he spun at the start of the final lap as the engine suddenly stopped and Red Bull went from second and fourth to nothing in a few moments.
Team principal Christian Horner said he did not yet know what had gone wrong but it "looks like an issue in the fuel system" for both cars.
Verstappen said: "It looked like there was no fuel coming to the engine and everything just turned off so I just rolled into the pit lane."
The Leclerc-Verstappen battle
After snatching pole position from Verstappen with the very final lap of qualifying, Leclerc held off the Dutchman's charge at the first corner and consolidated his lead through the first stint.
The Monegasque was 3.7 seconds in front by the time Verstappen made his first pit stop, but when Leclerc stopped the next time around, the Red Bull was right on the Ferrari's tail.
The defining period of the race followed.
Verstappen tracked Leclerc for a lap before diving down the inside into the lead into Turn One at the start of lap 17.
Leclerc repassed Verstappen around the outside into Turn Four, cutting across Verstappen as he edged ahead, but remained under threat.
Verstappen passed again at Turn One the next time around, and again Leclerc re-took the lead into Turn Four, this time diving to the inside.
Verstappen tried again into Turn One for a third time the next time around, but locked his front tyre, and slid straight on, allowing Leclerc to retake the lead.
From there, the Ferrari driver eked out his advantage again, building a lead of close to five seconds.
The last few crazy laps
After that, the Ferrari driver had just that bit too much pace for Verstappen.
Realising they had nothing to lose, Red Bull threw the dice with just over 10 laps to go, fitting soft tyres to Verstappen's and Perez's cars for a final sprint to the flag.
Ferrari chose not to follow Verstappen in with Leclerc but the new dynamic had no time to play out as Pierre Gasly pulled off with his Alpha Tauri in flames and the safety car was deployed.
Leclerc judged the restart beautifully, while Verstappen's attempt to harry Leclerc before he bolted from the last corner backfired and he came under pressure from Sainz.
He held him off, only for his race to unravel.
George Russell took fourth for Mercedes ahead of the revived Haas of Kevin Magnussen and Valtteri Bottas' Alfa Romeo, a strong drive from the Finn after a dreadful start dropped him right down the field from his sixth place on the grid.
The new rules introduced this year with the aim of closing up the field and making overtaking easier have certainly shuffled the pack, with Mercedes and McLaren the biggest losers and Ferrari and Haas gaining most.
But the race did not provide sufficient evidence for a definitive conclusion to be drawn as to whether their prime intentions have succeeded.
Driver of the day
What happens next?
The Saudi Arabian Grand Prix next weekend - last year's maiden race on the fast Jeddah street circuit was dramatic.