Home hero Rosberg surrendered his lead from pole with a dreadful start to the Briton, who stormed away to claim his sixth win in seven races and strengthen his grip in the title chase.
Second was Daniel Ricciardo, with Max Verstappen, his young Red Bull team-mate, third.
Reigning world champion Hamilton took full advantage of the poor start by Rosberg, who also received a five second pit-stop penalty for an over-aggressive passing move, to deliver a flawless drive.
"I am so happy to be here and to win for Mercedes Benz -- I have been with them since I was 13.
"Today it was about staying cool and I didn't make any mistakes and in my heart I felt I did a great job. For me, yesterday wasn't perfect, but you learn from those things."
For Rosberg, who was seeking to repeat his 2014 triumph, it ended up as a day of disappointment on home soil.
Briton Jenson Button, the 2009 world champion, finished eighth ahead of Finn Valtteri Bottas of Williams and Mexican Sergio Perez of Force India.
In front of a big race-day crowd who had come to see Rosberg grab back the title lead, it was Hamilton who was to seize the initiative from the off.
As the lights went out, the 31-year-old produced a perfect departure to dash past his team-mate.
