Hamilton leads the championship after four wins from the first six races, and teammate Valtteri Bottas has won the other two grands prix to give Mercedes a perfect record so far.
Ferrari, by contrast, has only scored four podiums and Vettel's Montreal pole is his first in a so-far tricky season for the four-time world champion.
Hamilton was on provisional pole after the first runs in Q3 but was overhauled by Vettel on the second runs and said Ferrari was "killing" Mercedes down the long back straight in the final sector.
Vettel complemented that sector three performance with a strong first sector that almost matched Hamilton, who was slightly slower in sector three compared to his first run.
Asked by Motorsport.com to describe his emotion, Vettel said: "This is one of the tracks where you need to dare going very close to the walls in many of the places.