Budapest: Red Bull's Daniel Ricciardo raced to the second win of his Formula One career after snatching the lead in the dying moments of a dramatic Hungarian Grand Prix.
Ferrari's Fernando Alonso finished second, scoring the best result of his season only days before his 33rd birthday, while Lewis Hamilton, who had started from the pitlane, charged through the field to finish third.
Hamilton's podium finish allows him to close gap in the title standings to team-mate and title-rival Nico Rosberg who, despite having started on pole, finished fourth after a race that was interrupted by two safety cars.
Rosberg now leads Hamilton by 11 points in the standings. He had gone into the race into the race with a 14-point advantage over the Briton.
Yesterday's win was the second of Ricciardo's career, with the Australian taking his maiden victory at the Canadian Grand Prix earlier this year, and comes in his first season with reigning world champions Red Bull.
"It feels as good as the first win, it really does," the Australian said on the podium after having let out a roar of delight over the team radio as he crossed the line.
"We're definitely going to celebrate tonight and party for a few days I think and enjoy a bit of time off."
Force India's Sergio Perez gets out of his car after crashing during the Hungarian GP. Pics/Getty Images
"To get two victories is phenomenal, I have a few mates here as well so we will party hard tonight," said Ricciardo, who remains the only driver to have won a race apart from the Mercedes pair this season.
A Rosberg win had looked inevitable after favourite Hamilton, who has won in Hungary a total of four times, was sidelined in qualifying by an engine fire without a time on the board, especially with the German starting on pole.
But mixed conditions, with the race starting on a wet track, and three safety cars shook up the field, putting several drivers in contention for the win.
Five drivers led the race and as the various strategies in the changing conditions unfolded around the safety car periods, Ricciardo, Alonso, Hamilton and Rosberg all looked on course for the win at different times.
"The safety car at first played to our advantage but the second one didn't really help us, but we got there in the end and I had to do the overtaking at the end which was fun," Ricciardo said.
Felipe Massa finished fifth in the Williams while Kimi Raikkonen, who had failed to make it beyond the first phase of qualifying on Saturday, recovered to sixth which was also his best result of the season.
Sebastian Vettel finished seventh, after a spin down the start-finish straight in the tricky conditions and a light contact against the pit wall left him on the back foot.
The reigning world champion still managed to beat Valtteri Bottas whose run of three straight podiums came to an end with the Williams driver crossing the line eighth.
Jean-Eric Vergne was ninth in the Toro Rosso, having run as high as second at one point, while Jenson Button finished tenth.
The Briton had briefly jumped into the lead following the first safety car as he gambled on staying on intermediate tyres. But with the expected rain not materializing, the Briton fell back through the field and was forced to pit.
Neither Force India finished with Nico Hulkenberg retiring after colliding with team-mate Sergio Perez. The Mexican was able to continue following the collision only to lose the car and spin into the pitwall a few laps later.
Rivalry between Lewis Hamilton and his Mercedes teammate Nico Rosberg reached a new peak as Hamilton rebuffed team orders to let championship leader Rosberg by into third place yesterday. Hamilton declared himself "shocked" at the request.