The young Australian Daniel Ricciardo won the Hungarian Formula One Grand Prix for Red Bull while Lewis Hamilton roared from pitlane to podium in another astonishing performance by the Mercedes driver.
Ferrari's Fernando Alonso was second and championship leader Nico Rosberg, who started on pole position for Mercedes, finished fourth and saw his lead over Hamilton cut from 14 points to 11.
Ricciardo, a revelation in his first year at Red Bull, took the chequered flag 5.2 seconds ahead of the Spaniard for his second win of the season and his career, in a race full of incident and two safety car periods.
Ricciardo swept past Hamilton three laps from the end and overtook a determined Alonso to regain the lead for good with two laps to go.
Hamilton had to start from pit lane after his car had caught fire in qualifying before he had completed a lap.