Valtteri Bottas beat Mercedes teammate Lewis Hamilton to take pole position for the season-ending Abu Dhabi Grand Prix on Saturday.
Hamilton, who secured his fourth world title two races ago, led on the first two split times but faded on the final sector.
Bottas secured his second straight pole following the Brazilian GP two weeks ago and the fourth of his career — all since joining Mercedes this season from Williams.
"I was so gutted in Brazil to be on pole and miss out on the win," said Bottas, who had a narrow escape earlier Saturday in the third and final practice. "I have a clear target for tomorrow."
The Finnish driver set a lap record on the 5.6-kilometer (3.5-mile) Yas Marina circuit, clocking 1 minute, 36.231 seconds. He was .172 seconds ahead of Hamilton and about half a second clear of Ferrari's Sebastian Vettel.
"I've only won once from pole, but I've had not had so many poles," said Bottas, who won the Austrian GP from the front in July.
After just missing out on a 73rd career pole, and a personal best-equaling 12th of the season, Hamilton was keen to praise Bottas.
"He had an incredible qualifying session and congratulations to him," said Hamilton, who hugged Bottas. "I lost it on turn five or six ... I gave it everything I could but it was really on a knife edge."
Vettel, who won in Brazil, finished ahead of Red Bull driver Daniel Ricciardo and Ferrari teammate Kimi Raikkonen in fifth.
A sixth win of the season will lift Vettel's confidence after his title bid spectacularly collapsed between September and October.
"It's important to set yourself up for the winter and give the whole factory a boost," Vettel said, looking ahead to 2018.
Next year, Hamilton and Vettel will both try to equal Argentine great Juan Manuel Fangio on five world titles. Only Michael Schumacher has more with seven and the German great also holds the record for race wins with 91.
Hamilton is second all-time with 62 wins. Four-time champion Alain Prost is third with 51 and Vettel fourth with 47.
Qualifying was close.
Bottas found the speed to challenge Hamilton, who has been consistently quicker this season.
Hamilton set a lap record in the first part of qualifying — known as Q1 — before Bottas went even faster.
Five drivers are eliminated from Q1 and from Q2 to leave 10 fighting it out for pole in Q3.
Pascal Wehrlein and Marcus Ericsson (both Sauber), Lance Stroll (Williams), Pierre Gasly (Toro Rosso) and Romain Grosjean (Haas) all went out in Q1 as the sun started to sink and nightfall descended on the desert-located track.
Bottas looked sharp again as he led Q2 before Hamilton moved top of the leaderboard, with Vettel and Raikkonen following behind.
Meanwhile, Brazilian veteran Felipe Massa just sneaked into Q3 at the expense of McLaren driver Fernando Alonso.
Competing in his last ever race, the 36-year-old Massa starts from 10th, behind Esteban Ocon and then Sergio Perez (both Force India). Renault driver Nico Hulkenberg goes from seventh behind Red Bull driver Max Verstappen.
Sunday's race also starts at 5 p.m. local time (1300 GMT) and finishes under floodlights when the heat drops considerably.
Earlier, in far hotter conditions on a sun-drenched track, Hamilton was fastest in the third and final practice.
The 32-year-old British driver placed 0.273 ahead of Bottas, whose somewhat lucky escape came as he skidded left off track and narrowly avoided clipping the barriers.
Raikkonen, looking for his first win since the 2013 season opener in Australia, trailed Hamilton by .530 in third.
Hamilton was fastest in Friday's second practice, breaking the lap record set by Vettel in P1.
Although Hamilton is under no pressure here, he will be keen to avoid a repeat of 2015.
That year, he won the title even earlier — with three races to spare — but then did not taste victory for eight straight GPs.
Dropped points were made to count when he was narrowly beaten to the 2016 title by then-Mercedes teammate Nico Rosberg.