Red Bull's Daniel Ricciardo took a sensational victory in the Chinese Grand Prix as a chaotic final 20 laps threw the championship wide open.
Ricciardo drove beautifully to pass five cars after Red Bull chose to pit for fresh tyres in a safety-car period.
Team-mate Max Verstappen stopped at the same time - but threw away his chances with two errors caused by over-optimistic driving.
Lewis Hamilton finished a frustrated fifth, but was promoted back ahead of Verstappen, who was penalised for causing a collision with Ferrari's Sebastian Vettel.
The result means Vettel's lead over Hamilton in the championship has been cut to nine points.
Mercedes driver Valtteri Bottas, who finished second, is only five behind the Briton, and Ricciardo a further three behind the Finn.
How did Ricciardo do it?
Bottas appeared on course for an excellent victory over Vettel before the safety-car period, having jumped Ferrari during their pit stops.
There will be a post-mortem at Ferrari as to how they let that happen, given Vettel was leading by more than three seconds before Bottas' stop on lap 19 of 56. Vettel stopped a lap later.
But the safety car threw in a curve ball and Red Bull grabbed their chance.
It was introduced so marshals could clear debris from the hairpin after a collision between Toro Rosso's Pierre Gasly and Brendon Harley.
At the time, Bottas was leading from Vettel, Verstappen, Hamilton, Ricciardo and the second Ferrari of Kimi Raikkonen, whose race had been sacrificed to try in vain to help Vettel earlier in his fight with Bottas.
Mercedes and Ferrari chose to leave their cars on medium-compound tyres that by then were about 10 laps old, but Red Bull decided to switch to fresh softs and that gave them a decisive pace advantage.
Verstappen was at this stage favourite to win, as the lead Red Bull driver, but he tried a move around the outside of Hamilton at the fast Turn Seven from too far back on lap 39 and ran off the road, letting Ricciardo past.
The Australian, who had already passed Raikkonen, then picked off Hamilton, Vettel and Bottas to clinch a stunning win.
The moves on Hamilton and Bottas were made in his trademark style - making a hugely committed dive down the inside from a long way back, but always in total control on the edge of adhesion. Ricciardo does it repeatedly, but it is something no other driver is consistently able to match.
"Sometimes you just have to lick the stamp and send it," Ricciardo said. "I don't seem to win boring races. They are all pretty fun but that was unexpected."
Bad moves by the top two
As the Red Bulls charged, Hamilton pointed out to his team in the pits that they had been caught out by not stopping to change what was the slowest tyre which already had significant life on it.
It was not the first time Mercedes had been caught out on strategy this season - Hamilton lost the win in the first race in Australia because of a miscalculation in the pits.
In Mercedes' defence, Ferrari also chose not to pit Raikkonen, but both teams suffered as a result. Bottas and Vettel had already passed the pit entry when the safety car was deployed so could not have pitted.
More mistakes from Verstappen
Vettel said he was anticipating an attack on lap 43 and left a little room on the inside in case Verstappen misjudged the corner "but obviously he misjudged more than I thought".
Verstappen was too far back to try a realistic move but he threw his car down the inside at the apex, locked his rear wheels and slid into Vettel, earning a 10-second penalty from the stewards for causing a collision. He apologised to Vettel afterwards.
Before the race Verstappen's team had reminded him of the importance of a clean weekend following a series of incidents in the first two races of the season.
Vettel dropped back to seventh - a position he then lost to McLaren's Fernando Alonso with two laps to go when the Spaniard passed him around the outside of Turn One and into Turn Two.
With Ricciardo now untouchable, Raikkonen began to pressure Bottas for second, but the younger Finn held on.
A frustrated Hamilton was passed by Verstappen with eight laps to go but the Red Bull driver did not manage to pull out enough of a lead over the Mercedes to keep the place once his penalty was applied.
Behind him, Renault's Nico Hulkenberg drove a solid race for sixth, ahead of Alonso and an angry Vettel.
Driver of the day
What happens next?
There is a two-week break before the Azerbaijan Grand Prix, where the long, long straight is likely to leave Red Bull breathless and make Ferrari favourites. But Ricciardo won in a harum-scarum race last year, so anything could happen.
What they said
Ricciardo at the post-race press conference: "Once I was aware we had the pace I wasn't going to let it slip. I feel every win I have had has been in similar circumstances. It was crazy, a lot of fun. After yesterday I thought I was starting the race at the back. The team were rewarded for getting out in qualy but this is the best reward."
Hamilton said: "I was in no man's land today. I had no pace and was just trying to hold on for whatever I had.
"We have been underperforming. Yesterday and today was a disaster on my side. I have got to rectify that and get back into normal performance mode otherwise more points will be lost. (We were) thankful for a few incidents ahead that kept us in the battle."
Vettel on his crash with Verstappen: "I didn't see him until late and left a bit of room. I was expecting him to come earlier. I had no intention of resisting, there was no point in doing so they were too fast. I didn't want to compromise my race.
"He did a mistake and locked up which happens. He misjudged it and compromised both of our results.
"He is not young anymore he has had enough races but that can happen when you have done 300 races."
Raikkonen, who finished third: "I think we made a good start, got blocked a bit and got passed in the first corner. We stayed out very long and got a little luck on the safety car.
"In the end we would have needed the soft tyres to really go for it. Once you get close it is so difficult to follow people."
Bottas, who finished second: "The race was going pretty well for us and we were looking strong until the safety car. We were in trouble then really and it is disappointing. It felt like we deserved victory but not today
"This is racing, these things happen."