HOCKENHEIM, Germany (AP) — Lewis Hamilton won the German Grand Prix on Sunday, solidifying his lead in the Formula One standings with two dramatic passes that made up for a strategic blunder by his McLaren team.

Hamilton overtook Ferrari's Felipe Massa and then runner-up Nelson Piquet Jr. of Renault at the same hairpin after a crash involving Timo Glock had brought out a safety car that nearly cost the McLaren driver his fourth victory of the season.

Most teams chose to pit when the safety car was out, but McLaren left its star driver out only to see him fall to fifth place when he pitted with 17 laps to race.

But Hamilton, who now leads Massa by four points in the overall standings, worked his way through the field before nudging past the Ferrari driver from the inside at turn No. 6 and then holding off Massa's outside challenge soon after.

Piquet Jr., who earned his first career podium after starting from 17th, couldn't hold off Hamilton when the 23-year-old Briton closed in at the same corner three laps later.