By Alan Baldwin
BAKU (Reuters) - Ferrari's Formula One championship leader Sebastian Vettel completed a pole position hat-trick on Saturday by beating title rival Lewis Hamilton to the top slot at the Azerbaijan Grand Prix.
The German, nine points ahead of Mercedes's reigning champion, will be hoping to convert his third pole in a row into a third victory in four races on Sunday.
Vettel pulled out a fastest lap of one minute 41.498 seconds, compared to the Briton's 1:41.677, on the quick street circuit along the shores of the Caspian Sea and around the walled old town.
Hamilton's Finnish team mate Valtteri Bottas was third with Australian Daniel Ricciardo, winner of a chaotic race in Baku last year and in China two weekends ago, qualifying fourth for Red Bull on an overcast and gusty evening.
"I think it will be an intense race. Anything can happen here and safety cars are very likely," said Vettel, who had struggled to break into the top 10 on Friday but led Saturday's final session.
- PHOTOS: What's Brewing in Steamy Hallows, the Harry Potter-Inspired Cafe19 Pictures
- PHOTOS: Frida Kahlo at the Brooklyn Museum doesn't hold back23 Pictures
"The good point is that our car was really good this afternoon so it should be in a good place tomorrow," added the four times world champion after his 53rd career pole.
"Yesterday I struggled a bit with confidence, with trust in the car and rhythm but today, when it clicks, it just keeps coming and it was really enjoyable."
Hamilton, also a four times champion but yet to win a race this season, lost time in the final sector and said it had been hard to keep the car straight in the crosswinds.
Second on the grid was still his best start position since pole in the Australian season-opener, with Ferrari sweeping the front row at the last two.
"That was close. We did the best job we could," said Hamilton.
"They were the quickest all weekend and they've obviously got a phenomenal car this year. But I'm really happy with the job the team did to get us from where we were yesterday to where we are today," said Hamilton.
"We're in the mix. I will try to give Sebastian a hard time tomorrow."
Red Bull's 20-year-old Dutchman Max Verstappen starts fifth alongside Ferrari's Kimi Raikkonen, who had looked like he could join Vettel on the front row for the third race in a row, and possibly beat him, but made a big mistake on his last lap.
"It's a pity for Kimi because until the last corner he could have been on pole," said Ferrari principal Maurizio Arrivabene.
The Force India pair of Esteban Ocon and Sergio Perez, who tangled in Baku last year in a clash that cost the team a likely podium, will line up together on the fourth row.
Nico Hulkenberg qualified ninth for Renault but the tall German will collect a five place drop for an unscheduled gearbox change, lifting his Spanish team mate Carlos Sainz to that position instead.
Canadian Lance Stroll, third in Baku last year, will start 10th for Williams -- the only team yet to score a point this season.
There was early drama when the Toro Rosso cars of Frenchman Pierre Gasly and New Zealander Brendon Hartley nearly collided.
Hartley was going slow due to a puncture, with Gasly swerving dramatically to avoid a huge collision and then driving down an escape road.
"That is unacceptable," exclaimed the startled Frenchman over the team radio.
"I was trying to get out of the way of Gasly, but I went the wrong way, sorry guys. I feel pretty stupid about Gasly," explained Hartley.
Haas's French driver Romain Grosjean qualified last and without setting a time after a gearbox failure.
(Reporting by Alan Baldwin, editing by Ken Ferris)