
Massa led from start to finish just like he did a year ago to win his second Turkish GP in succession, completing the 58 laps of 5.338 kilometres for 309.396 kilometres in a time of 1 hour 26 minutes and 42.161 seconds.
Team-mate Kimi Raikkonen came in 2.2 seconds behind Massa for a Ferrari 1-2 while third place went to defending champion Fernando Alonso in a McLaren-Mercedes with BMW-Sauber's Nick Heidfeld fourth.
Hamilton in a McLaren-Mercedes finished in fifth after suffering a puncture with 16 laps remaining, while running third.
Hamilton managed to hold off the late challenge of Renault's Heikki Kovalainen while Nico Rosberg in a Williams took seventh followed by Robert Kubica in the second BMW.
The result sees the Briton's lead over Alonso at the top of the championship standings cut to five points with five races remaining.
Hamilton now has 84 points, followed by Alonso on 79, Massa on 69 and Raikkonen one point further back.
"It's amazing. Third time in Istanbul but second race in a row from pole," said Massa. "It's amazing. I love this track."
Raikkonen started from third on the grid but managed to leapfrog Hamilton to move up one place to second going into the first corner.
Alonso had a poor start dropping from fourth the sixth behind Kubica and Heidfeld, causing the defending champion to lose time on the leading Ferraris.
However, Alonso's first pit stop came after Kubica and Heidfeld on lap 19, and the Spaniard returned ahead of the pair.
Raikkonen also pitted on lap 19 while Massa came in a lap later, returning ahead of his team-mate. Next of the leaders to pit was Hamilton, coming out in third.
The Finn pitted for the second and final time with 18 laps remaining, followed a lap later by Massa with the Brazilian once again returning in first place.
Massa was then able to drive within himself to a vital win while Hamilton saw his chances of a podium finish end when he suffered his puncture.
"I had a very good car but, unfortunately, it's very hard to pass in Formula One these days," said Raikkonen.
DPA