This is the sixth pole of the year for Massa, who needs to finish first or second on Sunday to have a chance of erasing Hamilton's seven-point lead. If the Brazilian wins the race he has to hope Hamilton finishes sixth or lower. Hamilton was fourth in qualifying.
Massa posted a time of 1 minute, 12.368 seconds in his Ferrari, delighting the tens of thousands of fans packing the 2.6-mile Interlagos track.
"We have a pretty long race tomorrow, but it's always better to start from the front," Massa said. "We have a good car. We proved our car is very competitive here."
Toyota's Jarno Trulli was second in 1:12.737 and Massa's teammate Kimi Raikkonen was third in 1:12.825. Hamilton was next in 1:12.830.
Massa also became the first driver to win three straight pole positions at Interlagos.
The fans celebrated wildly when Massa climbed out of his car to salute them. Ayrton Senna was the last Brazilian to win the championship in 1991.
"It's so nice to be here," Massa said. "Making the third pole in a row in front of this fantastic people. It's difficult to describe with a single word how I'm feeling."
Several banners posted by fans around the track had messages supporting Massa and wishing bad luck to Hamilton. One of them read, in English, "Hamilton: The lake's curve waits for you," referring to a turn at the Interlagos track just in front of a small lake.
Fans cheered loudly nearly every time Massa appeared on the big screens, and jeered just as loudly when Hamilton was shown.
About 70,000 fans are expected for the race on Sunday. Fans even climbed on rooftops and trees outside the track to try to get a glimpse of the action on Saturday.
Massa won his home race in 2006 and was second last year.
The Brazilian could become the first driver to win a title in front of his home crowd since the inaugural F1 season in 1950, when Italy's Giuseppe Farina won at the season-ending Italian GP. Massa could also become the first non-European driver to win the title since Canada's Jacques Villeneuve won in 1997.
Hamilton arrives at the Brazilian GP with a strong chance to become F1's youngest champion at age 23. Fernando Alonso was 24 when he won it in 2005. Hamilton can also become the first British champion since Damon Hill in 1996.
Hamilton, F1's first black driver, doesn't need to win Sunday's race to clinch the title. If Massa fails to cross the line in first or second, Hamilton will automatically win the championship.
Hamilton blew a seven-point lead last year in the Brazilian GP. A mistake in the first lap and a gear problem later led to a seventh-place finish that left him second in the standings behind Raikkonen.
Hamilton is using the same engine he had when he won the Chinese Grand Prix two weeks ago, while Massa has a new one. Drivers are required to use the same engine in at least two consecutive races.
Warm weather was expected for Sunday's race, and rain showers were possible.