Mark Webber won the Hungarian GP in his Red Bull to take the world championship lead after Sebastian Vettel’s chances of a dominant victory were ruined by a drive-through penalty.
Ferrari's Fernando Alonso finished second with Vettel completing the podium in third place.
Vettel led comfortably from Alonso until a safety car period to remove debris from the circuit shook up the order.
Webber was the only front runner not to pit under the safety car and took the lead of the race. The Australian then eased clear from second placed Alonso and built up a sufficient lead to be able to take his pitstop and still emerge in front of the Spaniard.
Vettel’s challenge ended when he was given a drive-through penalty for not keeping within 10 car lengths of Webber under the safety car. Vettel finished third and has now failed to win on six of the seven occasions he has started on pole this season.
Hamilton lost the championship lead after retiring and his McLaren teammate Jenson Button had a tough weekend, finishing in eighth place.
There were two incidents in the pit lane during the safety car period: the right-rear wheel detached from Nico Rosberg’s Mercedes before bouncing down the pitlane and Robert Kubica’s Renault collided with Adrian Sutil’s Force India.
Late in the race, Michael Schumacher nearly pushed Rubens Barichello into the pit wall as the Brazilian tried to overtake. The German has been given a 10-place grid penalty for the next round at Spa-Francorchamps in Belgium on 29 July.