Valtteri Bottas sprung the biggest surprise of the season so far after he beat Lewis Hamilton in Bahrain to secure the first pole position of his career.
Hamilton appeared set to claim his seventh pole on the spin, and 64th of his career, before Bottas - the man who has replaced champion Nico Rosberg at Mercedes this season - edged out his team-mate with the final throw of the dice.
Hamilton's championship rival Sebastian Vettel lines up in third with the Red Bull of Daniel Ricciardo fourth on the grid.
Ferrari, starved of championship glory for a decade, have finally produced a car which appears capable of challenging once more for motor racing's biggest prize.
And, prior to qualifying, there had been a sense of a changing of the guard after Mercedes failed to top either of the three practice sessions for the first time since the start of the 2014 season.
But as has so often been the case for the past three seasons, they delivered when it mattered most.
It was not Hamilton however, who will line up on the front slot on Sunday, but Bottas after he edged out his team-mate by just two hundredths of a second over 3.4 miles of track.
Hamilton was quickest in Q1, Q2 and then seemingly in the shoot-out for pole, only for the Finn to nick it in the closing seconds with his best lap of one minute and 28.769 seconds.
Indeed the former Williams driver was the only one of the front-runners to improve his time in their second and decisive runs.
Hamilton grabbed Bottas from behind before congratulating him in parc ferme. It was not a reaction he would normally have reserved for his last Mercedes team-mate.
Bernie Ecclestone is back in a Formula One paddock for the first time since he was ousted by the sport's new owners Liberty Media following their #6.4billion purchase in January.
And, perhaps unsurprisingly, the 86-year-old, who on Friday admitted he had never exchanged a single word with Sean Bratches - the American now operating as the sport's commercial chief - sat with two of his allies in Red Bull team principal Christian Horner and former Renault boss Flavio Briatore, rather than any of the new regime.
Ecclestone claimed he would not have allowed Fernando Alonso to miss next month's blue-riband Monaco Grand Prix. So, with that in mind, the double world champion will be pleased that Ecclestone is no longer in charge after yet another miserable day in which an engine problem meant he did not take to the track in the second phase of qualifying.
He is set to start 15th, but could drop to the back of the grid if he is required to change his Honda power unit. Jenson Button, his replacement for Monte Carlo, is unlikely to be chomping at the bit to get back in the hapless McLaren.
Button's departure from the sport has promoted Jolyon Palmer as the new British number two on the grid.
And after starting at the back for the past two races, the 26-year-old from Horsham, turned in a much-improved performance here to make it through to Q3 for the first time in his career. He will start 10th.
Kimi Raikkonen, under pressure from Ferrari following two disappointing rounds, is fifth with Max Verstappen sixth.