
Kimi Raikkonen clinched third place in the second Ferrari ahead of defending champion Fernando Alonso of Spain in a McLaren.
Brazilian Massa thrilled the home crowd as a lap time of 1 minute 11.931 seconds secured the ninth pole of his F1 career.
Hamilton finished 0.151 seconds adrift in 1:12.082 while Finland's Raikkonen registered a time of 1:12.161.
Hamilton holds a four-point lead over Alonso and sits seven clear of Raikkonen in the drivers' standings ahead of Sunday's decider.
If he comes first or second in the race or if both Alonso and Raikkonen fail to finish, Hamilton will become F1's youngest ever world champion at 22 years as well as the first driver to win the title in his rookie season.