Daniel Ricciardo, Fernando Alonso drink champagne on the podium
Lewis Hamilton fought up from a pit lane start and a first-lap spin to finish third as Daniel Ricciardo beat Ferrari's Fernando Alonso to win a sensational Hungarian Grand Prix.
And there may well be words behind the scenes at Mercedes after Hamilton refused orders to let team-mate Nico Rosberg pass by during the race.
Hamilton judged a thrilling wet-dry race perfectly to hold off title rival Rosberg, who finished fourth.
The result reduced Hamilton's deficit to Rosberg to 11 points.
A spectacular last 10 laps featured a three-way scrap for the lead when Alonso, Hamilton and Ricciardo's diverging strategies brought them together, and with Rosberg closing fast after his own late stop.
But Ricciardo passed Alonso for the victory with three laps to go.
A few laps earlier, Hamilton had been told to let Rosberg by to maximise the German's total race time.
Rosberg complained repeatedly on the radio, asking why Hamilton was not letting him past.
But Hamilton, realising that if he let Rosberg by he was at risk of finishing the race behind him, refused, saying: "Tell him to get closer."
Rosberg's stop on lap 56 ended the discussion, but it will certainly continue behind closed doors at Mercedes after the race.
One of the great F1 races saw the advantage swing backwards and forwards throughout after a wet start, two safety car periods and some thrilling racing in front of a large crowd.
Hamilton spun off the track in the first lap and touched the barrier, having started from the pitlane
Hamilton had survived a spin on the first lap and started to make up places, and was up to 13th when the first safety car period was triggered after a crash by Caterham's Marcus Ericsson.
Ricciardo's decisive move was to stop for fresh tyres when the second safety car period was caused by a crash involving Sergio Perez's Force India on lap 23.
That put Alonso into the lead, with Rosberg third and Hamilton fifth in a train of cars being held up by Toro Rosso's Jean-Eric Vergne in second when the race restarted on lap 27.
Rosberg pitted for fresh tyres five laps later, fitting 'softs' with the intention of making another stop.
Alonso and Hamilton waited until laps 38 and 39 for their own second stops, deciding not to pit again before the end of the 70-lap race.
Hamilton's stop promoted Ricciardo to the lead until his own final stop on 54, from which he rejoined fourth, behind Alonso, Hamilton and Rosberg.
Ricciardo reduced the gap to the leaders rapidly, from 6.6 seconds behind Hamilton on lap 57 to be on the Mercedes' gearbox four laps later.
Alonso was battling worn 'soft' tyres, Hamilton was on slightly newer 'medium' tyres and Ricciardo and the rapidly closing Rosberg in fourth on relatively fresh 'softs'.
Alonso cut the chicane on lap 63, prompting Hamilton to complain that "Fernando gained an advantage" but soon the Mercedes driver had to worry more about Ricciardo, who began to pile pressure on with his extra grip.
The final 10 laps involved an enthralling tussle for victory between Alonso, Ricciardo and Hamilton
Ricciardo took second with a superb move around the outside of Hamilton at Turn Two on lap 67 and dived past Alonso's struggling Ferrari for the lead at the start of the next lap.
But Alonso managed to hold off Hamilton, who in turn fended off his team-mate to the flag.
Earlier, Ricciardo's team-mate Sebastian Vettel threw away his own chances with a spin out of the last corner on lap 32.
Vettel had been one place ahead of Hamilton in the queue of cars behind Vergne, but ran wide out of the last corner on to the kerb and lost control.
Unlike Perez, who made exactly the same mistake seven laps after his car was damaged in a collision with team-mate Nico Hulkenberg on lap 16, Vettel did not hit anything and rejoined the race, but his hopes of victory were over.
Force India's Sergio Perez hit the wall hard on the start-finish straight after losing control on the final corner of the lap
Marcus Ericsson came to grief after losing control in the wet conditions