Vettel starts fourth but will look to benefit on Sunday.
Bottas made his best lap by covering the Baku City Circuit in a minute and 42.742 seconds, ahead of his countryman Kimi Raikkonen, who drives Ferrari, by just 0.095 seconds, reports Efe. "Second place is not bad though".
Red Bull's Max Verstappen recorded the fastest time in both of Friday's sessions, but withdrew in sixth after a complete power failure due to a suspected hydraulic issue, with the driver having previously complained about engine problems.
Daniel Ricciardo was responsible for the red flag after losing the back end of his Red Bull on the exit of turn six and qualifies 10th, while the Force Indias of Sergio Perez and Esteban Ocon went quicker than Williams duo Lance Stroll and Felipe Massa. "It was all or nothing", Hamilton said.
That incident turned the session into a one flying lap dash once the track was cleared, and Hamilton pulled out a stunning effort on his final run to claim pole by nearly half a second from Bottas.
"I was so on it - Q1, Q2, then Q3 I made that one little mistake and I was so frustrated I had made that mistake and the red flag came out when I was up again on my next lap and I was thinking "there is no way I was going to be able to do it on the first lap".
Verstappen leads FP2 of Azerbaijan F1
Red Bull's Ricciardo ended his day in third place and was satisfied with the improvements that the team made across the day. Bottas looked to be improving, and went P2 after his initial struggles, but the session was about to be suspended again.
Mercedes driver Lewis Hamilton of Britain, left and Mercedes driver Valtteri Bottas of Finland walk between their cars following the qualification at the Formula One Azerbaijan Grand Prix in Baku, Azerbaijan, Saturday, June 24, 2017.
Lewis Hamilton: "When I started that lap, I knew where I had to get the tyres to".
"So to come in this morning not really knowing if those changes were going to be right, I know I've got full confidence with the team but still it's very hard with the tyres to switch them on and off".
Alonso is set to drop to the rear of the grid thanks to his 40-place grid penalty for various engine component changes.
"With the place, with the feeling that we had, I'll happily take it and I'm not surprised with the time difference". "As I said other people were doing a better job and therefore their qualified in front of us". At the end I was alone and had no tow in the last sector.
"Obviously it's better than where I was before".
"In qualifying, sometimes you don't extract it, but it was a ideal lap". As a team we got what we could today and tomorrow I think can be a different story, the race pace can be quite strong.