Sebastian Vettel took a sensational maiden victory for Ferrari as he won a straight fight with Lewis Hamilton's Mercedes at the Malaysian Grand Prix.
Vettel, who joined Ferrari this year as Fernando Alonso's replacement, won a strategic battle as Mercedes struggled with tyres in the tropical heat.
Hamilton's team-mate Nico Rosberg was third from Ferrari's Kimi Raikkonen, who fought back from an early puncture.
The McLarens of Alonso and Jenson Button both retired.
The performance of Ferrari and Vettel was a wake-up call for both Mercedes and Formula 1, the German manufacturer having dominated the sport since the start of last season.
It raises the possibility that Mercedes will face an unexpected fight for this year's world title, with Ferrari very much on the world champions' pace all weekend.
Vettel, who started second, took the lead when Mercedes chose to call in Hamilton for a pit stop during an early safety car period, while Ferrari left the German out on track.
Mercedes preferred to do the majority of the race on the slower hard tyre, finding it had greater resilience on their car.
But Vettel used the faster medium tyre for all but one stint and Hamilton was unable to get on terms.
Vettel was still eight seconds in the lead when he made his first pit stop on lap 17 - 13 laps after Hamilton had stopped under the safety car - and he closed on Hamilton and Rosberg after rejoining in third.
A second stop by Hamilton only seven laps after Vettel's first put him 24 seconds behind the Ferrari, with half the race and one further stop for each remaining.
Mercedes continued to believe they could win until Hamilton made his final stop on lap 38, one after Vettel.
The world champion rejoined 14 seconds behind and, although he was slightly faster than the Ferrari, he was unable to close at anything like the required rate, Vettel holding him at a distance of about 10 seconds.
Tensions within Mercedes were revealed under the pressure of the fight, as Hamilton questioned the team's choice of the hard tyre for the critical final stint, and his engineer told him their only other option was a well-worn set of mediums.
That stemmed from Mercedes' decision to use the faster tyre in the first part of qualifying, a decision based on their preference for the hard as a race tyre, but which meant they only had one set of new mediums remaining for the race.
Vettel's victory was the 40th of his career - only one short of Ayrton Senna, who is third in the all-time list - and the first time Mercedes had been beaten since last July's Hungarian Grand Prix.
And it marks an amazing turnaround by Ferrari, who last year had their worst season for 21 years, managing only two podiums.
The Ferrari's pace in the difficult, tyre-melting conditions was underlined by Raikkonen's recovery to fourth.
He qualified in 11th, lost most of a lap with a puncture on lap two but, helped by the safety car closing up the field, drove well to regain lost ground and get the best possible result.
he Finn was followed by the Williams cars of Valtteri Bottas and Felipe Massa, the Finn passing the Brazilian in spectacular style around the outside of the fast Turn Five on the last lap.
Toro Rosso's 17-year-old Max Verstappen, racing impressively side by side with rivals through the frantic early stages, took seventh, just ahead of team-mate and fellow rookie Carlos Sainz Jr.
Both Red Bull junior team drivers beat the senior team's Daniel Ricciardo and Daniil Kvyat into ninth and 10th.
McLaren's performance had been encouraging while it lasted, Alonso running strongly in ninth place and closing on Kvyat before he was called in to retire with overheating of his hybrid system on lap 21.
Button, who out-qualified Alonso after the Spaniard made a mistake on his final lap on Saturday, was not quite able to match his team-mate's pace in the race and retired from close to the back of the field at about two-thirds distance with turbo failure.