Daniel Ricciardo beat Red Bull team mate Max Verstappen to fourth place, with Kimi Raikkonen sixth in the second Ferrari. Williams’ Valtteri Bottas and Felipe Massa, Force India’s Nico Hulkenberg, and McLaren’s Fernando Alonso completed the top ten.
Q2 was punctuated by a red-flag period five minutes in after Carlos Sainz clouted the right side of his Toro Rosso against the infamous Wall of Champions, eliminating the Spaniard on the spot.
The second phase also accounted for Force India’s Sergio Perez, pipped at the death by his team mate, McLaren’s Jenson Button, Toro Rosso’s Daniil Kvyat, and Haas’s Esteban Gutierrez and Romain Grosjean.
Q1 saw light rain in the closing minutes, and effectively ended with a late crash for Manor’s Rio Haryanto, who hit the wall with his right-rear wheel in Turn 4, picking up a puncture and spinning across the track before also brushing the left of the car against the barriers.
Joining the Indonesian rookie on the Q1 elimination list were Renault’s Jolyon Palmer, Manor’s Pascal Wehrlein, and Sauber’s Marcus Ericsson and Felipe Nasr.
Kevin Magnussen did not participate after Renault were unable to get his car repaired in time following his FP3 crash. With his R.S.16 requiring a new gearbox, the Dane is set to start from the back of the grid or - more likely - the pit lane.
Mercedes and Ferrari began slugging it out the moment Q1 began, and it was Rosberg who narrowly beat Vettel to the fastest time, with Ricciardo jumping up late to third for Red Bull ahead of Hamilton, Bottas and Raikkonen.
At the other end of the grid Haas duo Esteban Gutierrez and Romain Grosjean just made it through, surviving a late onslaught from Renault's Jolyon Palmer who - despite a brush with the wall of champions - improved at the death, but fell 0.015s shy of demoting Grosjean.
Once the red flags came in following Sainz's crash, the two Mercedes quickly jumped to the top of the times, with Hamilton's 1m 13.076s shading Rosberg's 1m 13.094s by just 0.018s. Bottas split the third- and fifth-placed Red Bulls, as Ferrari were a disappointing sixth and seventh with Raikkonen and Vettel eight-tenths off.
The Force Indias and McLarens, meanwhile, were locked in a fight to progress into Q3. Jenson Button looked set to secure his place, but dropped away in the final sector - unlike team mate Alonso, who jumped up to ninth with his final effort.
That left Perez in 10th, but in danger given Hulkenberg - on the brink of elimination in 11th - was on track and going quickly. The German made his last effort count to secure ninth, which meant Perez got bumped to 11th on 1m 14.317s ahead of Button on 1m 14.437s, Kvyat on 1m 14.457s, and the Haas pair of Gutierrez on 1m 14.571s and Grosjean on 1m 14.803s. Sainz's 1m 21.956s left him 16th.
Q3 began badly for Hamilton when he ran over the same Turn 14 yellow kerb on which he had damaged his car in FP3. This time it appeared to have had no ill effect, however, as his first run yielded a mighty 1m 12.812s. Rosberg was matching the Briton blow for blow, however, and crossed the line just 0.062s down.
Behind them, Verstappen provisionally took third with 1m 13.430s from Vettel on 1m 13.479s and Ricciardo on 1m 13.521s.
Vettel had a scare when he brushed the wall of champions, but he avoided damage and found massive gains on his second run to move into third. Hamilton had also improved on the first sector, but lost time over the remainder of the lap - a fact that went unpunished when Rosberg locked up at Turn 1 and abandoned his own effort.
Pole therefore was Hamilton's - his fourth of the season, fifth in Canada, and by the closest margin so far in 2016.
Thus the provisional grid will line up: Hamilton, Rosberg; Vettel, Ricciardo; Verstappen, Raikkonen; Bottas, Massa; Hulkenberg, Alonso; Perez, Button; Gutierrez, Grosjean; Sainz, Kvyat; Palmer, Wehrlein; Nasr, Haryanto; Ericsson, Magnussen.
Kvyat and Ericsson have three-place grid penalties for causing collisions at the previous round in Monaco, while Magnussen takes a five-place drop after being forced to change gearbox as a result of his crash in FP3.