Hamilton improved on his final hot lap in qualifying to narrow the gap to Vettel to 0.179 seconds, who was fortunate that Kimi Raikkonen could not upstage him after losing the rear of the auto at Turn 16. Valtteri Bottas moved up to second during his teammates stop, but Hamilton was able to re-enter the race in the third spot.
Canadian Lance Stroll, third in Baku a year ago, will start 10th for Williams - the only team yet to score a point this season. Sergey Sirotkin retired after he was involved in an incident with the other Force India vehicle of Perez, Alonso and Nico Hulkenberg.
As luck would have it, a safety vehicle was triggered on Lap 40 when Red Bull Racing teammates Max Verstappen and Daniel Ricciardo collided with each other, allowing Bottas to switch to new ultrasoft tires and maintain his race lead. He was forced to retire as a result.More news: Manchester United vs Arsenal
Hamilton eventually was told to finally box at Lap 22 and came out ahead of Verstappen taking P3 behind his team mate Bottas. But when the Safety Car was called into action, following the two Red Bulls' high-speed collision, Bottas - having inherited first after delaying his stop for fresh rubber - got a free pit stop and retained the lead. Daniel Ricciardo and Max Verstappen were racing too close for comfort throughout the race and in the end the crash was nearly inevitable. So it's always going to be an issue, and this time I was unlucky and I have no idea at any point if I ran at any debris, I didn't see anything, I didn't feel anything.
At one stage he even called for the event to be abandoned as a truck precariously dealt with Romain Grosjean's stricken Haas after the Frenchman crashed out under the safety auto. He was taken away in a medical vehicle on the track.
"There was so much time to do it. Safety auto was on for forever, why did nobody pick it up?"More news: Acting Armenian PM says opposition is monopolising political process-Shant TV
Hamilton revealed the extent of the changes Mercedes made to its cars after practice stating the team changed "pretty much everything".
In a nutshell, a late safety vehicle after the Red Bulls collided (more on that later) saw Mercedes jump Sebastian Vettel - long time race leader - and Bottas looked to be set for a win, but a puncture in the closing laps saw him out and the race handed on a plate to Lewis Hamilton.
Bottas, who had lost out on a win in the last race beacuse of a SC, was firmly in control. But the Red Bull pitwall watched on nervously. "We can't let one or two seconds from the race have a shame on all the race, because there are a lot of positives". It wasn't until lap 35 that Ricciardo broke Verstappen's resistance and overtook the Dutchman around the outside of Turn 1 in trademark fashion.
While happy with his performance, Ricciardo is focused on his prospects for tomorrow, suggesting a possible back-to-back win in Baku is in the cards, but a lot will depend on track conditions. They had been fighting for fourth place at 220mph - on the fastest piece of tarmac in the world. But do we struggle less than them? I also wanted to go for the inside, but once I locked up, it was tough luck.More news: "Back to Denver I go" Bradley Chubb shares throwback to 2011 visit
Most of all, he needed team-mate Valtteri Bottas to be robbed of victory in the cruellest of circumstances - the race leader's right-rear tyre exploding less than three laps from the chequered flag.