Carlos Sainz said Ferrari "didn't put a foot wrong" as the Spanish driver drove a perfect race to win a thrilling Singapore Grand Prix on Sunday and end Red Bull's hopes of sweeping every race in 2023.
But an emotional George Russell was close to tears after crashing his Mercedes on the final lap after attempting a late victory charge on fresher tyres.
Lando Norris was second after a brilliant defensive drive to hold off the Mercedes pair as Lewis Hamilton crossed the line in third after teammate Russell's lapse.
Championship leader Max Verstappen, who had won the last 10 races, was only fifth as Red Bull failed to take the chequered flag for the first time this season after a weekend where they were consistently off the pace.
His teammate Sergio Perez crossed the line eighth.
Sainz controlled the night race around the city-centre street circuit brilliantly from pole position to take only his second career win, the first coming at the British Grand Prix last year.
"An incredible feeling. We didn't put a foot wrong all weekend," said Sainz.
"We nailed the race. We had one opportunity to win a race this year and we did it perfect," added the Spaniard.
Sainz seemed set for a comfortable win until a virtual safety car 20 laps from the end gave the two Mercedes the chance to change to fresh medium-compound tyres.
Russell and Hamilton came out flying and soon reeled in and passed the second Ferrari of Charles Leclerc, who finished fourth.
But when they got on the heels of the top two they could not get past as Sainz cleverly backed up to keep his former teammate Norris within DRS (drag reduction system) range so the Englishman could defend second place.
"It was just quite tight at the end. We gave Lando a bit of a cheeky DRS boost to help him and in the end it worked," said Sainz.
"The safety car forced us to pit earlier than we wanted and I knew it was going to be a long stint on the hards."
- 'Very generous' -
Russell was all over the back of Norris until his challenge ended in the barriers, handing Hamilton the final podium place.
"It's heartbreaking after such a great weekend," said Russell. "I feel like I let myself and the team down. It's tough but we will come back."
Norris was grateful for the help he received from Sainz, his former teammate.
"Carlos was very generous trying to help me get DRS. It helped my race and it also helped his," said Norris.
Alpine driver Pierre Gasly was sixth, with McLaren's Oscar Piastri seventh.
Rookie Liam Lawson picked up his first championship points in ninth for AlphaTauri on only his third Formula One start and Haas's Kevin Magnussen rounded out the top 10 points scorers.
Sainz began the race smoothly to take the lead with Leclerc slotting into second and there was little action until Logan Sargeant prompted a safety car when he lost the front wing of his Williams on lap 20.
A flurry of pit-lane activity followed as all the leaders headed in for fresh hard tyres to take them to the end of the 62-lap race.
Leclerc was held up double-stacking behind Sainz and Russell and Norris emerged in front of the Monegasque.
The order was unchanged until Esteban Ocon's engine gave out causing a virtual safety car with 18 laps left.
It prompted the Mercedes pair to dive in for fresh medium tyres as the leaders stayed out.
It put the pair behind Leclerc but they were lapping two seconds quicker and soon swept past the Monegasque and closed on Norris until Russell's error cost him a podium place.
Verstappen is still a runaway favourite to claim a third world title but the all-conquering Dutchman has still never taken the chequered flag in Singapore.
He now cannot clinch the title until the Qatar GP in three weeks' time, but said the team would bounce back at next weekend's Japanese Grand Prix, where the track will suit them better.
"I had fun in the second stint. We were quite quick on the medium compound," said Verstappen, who increased his lead over Perez to 151 points with seven races to go.
"I think we will be quick in Suzuka."