After everything played out behind the safety car Hamilton emerged with the lead of the race. Mercedes teammate Valtteri Bottas briefly attacked the reigning world champion on the re-start but was told over the radio to hold position.
The pair recorded the first Mercedes one-two finish in Germany and ensured the team took over the lead of the constructor's championship.
Hartley made a solid start but dropped one place by the end of the first lap.
"I'm happy with how today went," the Kiwi said. "I lost some time behind the Williams at the beginning but I had some fun battles out there. We definitely had good pace on the harder compound tyre, but I struggled at the end when I moved on to the Ultrasoft.
"I was disappointed to lose a place to Grosjean but he had a lot more pace than me. I kept it clean and we made the right call to brave it and stay out when the rain came.
"The team and myself had great communication during the changing conditions and in the end it paid off. I also used some of my experience from endurance racing to help make the call, so I'm really happy with the race I did and to bring home one point."
Hamilton worked his way through the field from 14th on the grid and found himself up to fifth by the end of the 15th lap.
"Highly unlikely but you've got to believe" Hamilton said of his chances of winning from his starting spot of 14th.
"I kept pushing, kept believing and I manifested my dream today, so thanks to God".
Bottas accepted his team's decision to force him to hold behind Hamilton late in the race.
"When Seb went off I thought now was a good time, but I think the safety car came at a better time for Lewis," Bottas said.