Mercedes driver Lewis Hamilton grabbed a last-ditch pole position in a thrilling wet qualifying session at the Australian Grand Prix.
Hamilton edged out Red Bull's Daniel Ricciardo by 0.317 seconds with the very last lap of the session.
Ricciardo's world champion team-mate Sebastian Vettel was only 13th.
Hamilton's team-mate Nico Rosberg took third ahead of an impressive debut from McLaren's Kevin Magnussen in fourth and Ferrari's Fernando Alonso in fifth.
The Spaniard's team-mate Kimi Raikkonen was 12th after crashing in the second knock-out session shortly after completing a lap 1.6secs slower than Alonso.
It was an exhilarating way to start a new season that has seen the introduction of the biggest rule changes in F1 for a generation.
Red Bull's recovery from a troubled pre-season programme has been impressive but Vettel was not the beneficiary.
The German, who has won the last four World Championships, had a scrappy qualifying session. It was the first time he had failed to make it into the top 10 shoot-out since the 2012 Belgian Grand Prix.
Vettel pitted towards the end of the second session for a fresh set of intermediate tyres, hoping to benefit from their increased grip on the slippery track.
But while Ricciardo, who stayed out on track on his tyres, finished the session second fastest behind Rosberg, Vettel could not improve. As he walked back to the garage, the reigning world champion was booed by some fans in the crowd.
Vettel later said he had suffered an engine mapping software problem which affected the "driveability" of the car.
The final session produced a nail-biting conclusion as drivers tried to second-guess the ever-changing conditions.
A heavy shower before it started led most to start the session on full wet tyres, but as the track dried drivers were split as to whether the intermediate would be a better choice for the final runs.
Ricciardo went for the intermediates while everyone else bar Williams' Felipe Massa went for the full wets.
Hamilton went fastest initially, only to be beaten by Rosberg, who was then toppled by Ricciardo, before Hamilton grabbed top spot back with the very last lap of the session.
In doing so, Hamilton moved into sixth on the all-time list, equal with fellow Briton Nigel Mansell on 32 pole positions.
"It's been an interesting weekend and today has made it so much harder for everyone with the conditions, but I'm really happy for the job the team did," Hamilton said.
"These new cars are a lot harder to drive in the wet and it was the first time for me in the wet, as I'm sure it was for a lot of people. It's great to be up here with Nico."
Ricciardo, who had the edge on Vettel throughout qualifying, said: "To start the season with a front row does a lot for the confidence.
"The weather added to the mix and the whole session went well. Q1 looked like it was going OK for us and then when the rain came it is the first time we have driven these cars in full wet conditions.
"I'm really excited, but tomorrow is what counts."
Behind Alonso, Toro Rosso's Jean-Eric Vergne took sixth ahead of Force India's Nico Hulkenberg, the second Toro Rosso of rookie Daniil Kvyat, Massa and the second Williams of Valtteri Bottas, who has a five-place grid penalty because of a gearbox change ahead of qualifying.
Alonso is under investigation for impeding Gutierrez. Magnussen is under scrutiny from the stewards to find out whether he slowed down enough under yellows. Vettel was cleared by the stewards for the latter incident.
Lotus have had a terrible weekend, struggling with reliability problems and getting almost no track time.
Neither car was ready to go out for the start of first qualifying and by the time they did get out on the track they did not set a competitive lap time before it started to rain.
Romain Grosjean and team-mate Pastor Maldonado qualified right at the back in 21st and 22nd places.