In his hometown, Massa drove his Ferrari to victory ahead of runner-up Fernando Alonso.
Hamilton, who needed to finish the race in fifth place to win the title, passed Toyota's Timo Glock with his McLaren and grabbed fifth as he entered the last corner.
Hamilton, F1's only black driver and the subject of racial taunts last week, became England's first champion since Damon Hill in 1996.
During the last lap, Hamilton also recovered when challenged for fifth by Toro Rosso's Sebastien Vettel while changing tires following a late and unexpected shower.
"That was a really tough race," the 23-year-old Hamilton said after he became the youngest driver to win a World Championship in F1 history. "We never pushed hard, but we never did anything silly, and of course the late rain made things extraordinarily tense."
2014: The Year in Music [PHOTOS]