BAKU (Reuters) - Lewis Hamilton surpassed Ayrton Senna's career haul of 65 pole positions in Formula One as he edged Mercedes team mate Valtteri Bottas in a final lap shootout to secure top spot for Sunday's Azerbaijan Grand Prix.
Hamilton banished memories of a dismal qualifying session in Baku last year, when he clipped the barrier and had to settle for 10th place on the starting grid, to grab pole with a time of 1:40.593 despite running wide at Turn 16.
He will be joined in an all-Mercedes front row by Bottas, who was pipped at the death when Hamilton outpaced him in the final lap after the session had been paused by a red flag.
"That was one of the most exciting laps that I've had all year," he told Sky Sports. "A lot of pressure.
"The first lap I had the time but I made a mistake," he added.
"(There was) a lot of pressure because of getting temperature in the tyre but the lap just got better and better. Coming out of the last corner I was just 'thinking please be enough'."
The British driver is now just two behind Michael Schumacher's overall record of 68 poles in Formula One.
"That's how qualifying should be," Hamilton added. "Tomorrow will be a long hard race but we're in the best position to start."
Sebastian Vettel had his championship lead cut to 12 points when Hamilton won in Canada earlier this month, and now faces an uphill struggle to fend off his rival again after qualifying fourth.
"The result is okay but I'm not entirely happy," the four-times Formula One champion said. "This morning didn't help but it's not an excuse.
"I'm no fan of excuses."
Vettel was beaten to third by team mate Kimi Raikkonen in an all-Ferrari second row.
Max Verstappen dominated Friday practice but Red Bull failed to have the anticipated impact as he qualified fifth and his team mate Daniel Ricciardo was down in 10th after hitting a wall, prompting the red flag which led to the last-lap shootout.
"It's not really nice to be in fifth," Verstappen conceded. "In Q3 on my final lap, where it all counts, I was two tenths faster but then had a problem with my gear sync, so on the straights I was losing a lot of lap time.
"That was very painful," he added. "We need to get on top of that because it shouldn't happen."
Canadian youngster Lance Stroll, in eighth, out-qualified his fellow Williams driver Felipe Massa, who was ninth. Force India duo Sergio Perez and Esteban Ocon finished sixth and seventh respectively.
Fernando Alonso, already hit with a 40-point grid penalty, failed to advance past Q1 for the first time this season, while Jolyon Palmer did not take part in qualifying after a fire in his car during Saturday morning's practice.
Reporting by Ed Dove, editing by Pritha Sarkar