SAKHIR, Bahrain (AP) Valtteri Bottas beat Mercedes teammate Lewis Hamilton right at the end of qualifying on Saturday to take pole position for the Bahrain Grand Prix. It was the first pole in Bottas' career.
Hamilton took pole in the first two races of the season, and had the leading time until Bottas beat him on the last lap.
''It took a few races, but hopefully it's the first of many,'' said Bottas, who is competing in his 80th F1 race but only his third with Mercedes. ''I'm getting better with the set-up of the car. Feeling more comfortable.''
Bottas became the first Finnish driver to take pole since Heikki Kovalainen at the British GP in 2008 - the race after Kimi Raikkonen's pole at the French GP - and the fifth overall. Keke Rosberg and Mika Hakkinen also qualified first during their careers.
''It's a lot of races without a Finn on pole,'' Bottas said.
Bottas also denied Hamilton his 64th pole.
''That's how close qualifying should always be, it forces us to be on the limit,'' said Hamilton, who had taken pole in Bahrain for the past two years. ''I'm genuinely happy with the job I did.''
Bottas clocked a leading time of 1 minute, 28.769 seconds over the 5.4-kilometer (3.3-mile) track in Sakhir, compared to 1:28.792 for Hamilton.
Ferrari's Sebastian Vettel was a bit disappointed with third.
''I crossed the line, looked up and saw both were ahead,'' said Vettel. ''When I got the time I was a bit down to be honest. Four tenths was a lot more than I expected, given how good the lap felt.''
The 27-year-old Bottas will now aim for his first win.
''I feel I'm now in the game,'' he said.
Bottas left Williams to join Mercedes this season as an emergency replacement for German driver Nico Rosberg - Keke Rosberg's son - who quit F1 just days after winning the title last year. Bottas has 10 podiums with a best finish of second.
Moments after they had climbed out of their cars, Hamilton grabbed Bottas, hugged him and shook him firmly by the hand.
''Valtteri found some great pace,'' Hamilton said.
Red Bull's Daniel Ricciardo was fourth, with Ferrari's Raikkonen fifth ahead of Max Verstappen's Red Bull.
Although not as hot as Friday, drivers still had to deal with afternoon track temperatures of 37 degrees Celsius (99 degrees Fahrenheit) during P3. By the evening, the heat had dropped off to a more comfortable 30 C (86 F) - similar conditions to Sunday's race, which starts at dusk and ends under floodlights.
Hamilton and Vettel are level at the top of the championship standings. In an exciting start to the season, both have one win and one second-placed finish each, with Vettel winning in Melbourne and Hamilton responding in Shanghai.
''It's great how close it is between the teams, it brings out the best in each driver,'' Hamilton said. ''The more drivers you have in the mix, the more intense it gets.''
Hamilton won in Bahrain in 2014 and 2015, on his way to his second and third world titles with Mercedes. Vettel won in 2012 and 2013 during a glittering run of four straight titles with Red Bull.
Five drivers are eliminated from the first two parts of qualifying - Q3 and Q2 - to leave the best 10 in Q1. Hamilton topped Q3 and Q2.
In a boost for Renault, both drivers made the top 10, with German Nico Hulkenberg seventh and Briton Jolyon Palmer 10th.
But McLaren's frustrations continued.
The team struggled last year after switching back to Honda engines and it looks like things are getting worse. Fernando Alonso and teammate Stoffel Vandoorne have not scored a point yet.
Alonso, a two-time world champion, did not even make it into Q2 after his engine's power unit broke down. He will start from 15th and needs a new engine for the race.
''It's a shame,'' the Spanish driver said.
Vandoorne starts from 17th, making it unlikely that McLaren will get in the points here.
Carlos Sainz Jr. had shown good speed during practice, but qualified 16th as his Toro Rosso was hit by a power failure late in Q1.
In the third and final practice, Verstappen narrowly beat Hamilton - but the 19-year-old Dutchman could not carry that into qualifying.
Still, starting from sixth on the grid will not faze him.
Last weekend, Verstappen started from 16th on the grid and finished third.
''It was definitely possible to be a bit further forward,'' Verstappen said. ''But last time I started a bit further behind and ended on the podium so anything is possible.''