Hamilton had to pass both Williams after losing the lead off the line and second place at a re-start following an early safety car.
But the Mercedes driver fought back to take the lead at the first pit stops.
Rain made for a chaotic end to the race but Hamilton came through to win from team-mate Nico Rosberg and Ferrari's Sebastian Vettel.
Felipe Massa took fourth ahead of Williams team-mate Valtteri Bottas, Red Bull's Daniil Kvyat was sixth, Force India's Nico Hulkenberg claimed seventh and the second Ferrari of Kimi Raikkonen came eighth.
The world champion's fifth win of the season - extending his championship lead to 17 points - was greeted with roars of delight from the capacity 140,000 fans.
Hamilton admitted the Mercedes' bad starts had "made the race for the fans" and, as thousands streamed on to the track to salute him on the podium, he said: "Thank you for coming out today and making my whole weekend, I really wanted to do it for you guys. I couldn't have done it without you. I'm so elated. You can't imagine how happy I am. I was tearing up on the last lap."
Hamilton's path to victory was far from smooth, however, as Massa leapt into the lead past both Mercedes from third on the grid.
Hamilton fended off a challenge from Bottas for second on the first lap, at the end of which the safety car was deployed because of a pile-up at the first corner, involving both Lotuses and both McLarens.