Ricciardo claimed what was his first Grand Prix triumph since August 2014 as Max Verstappen finished second and Hamilton's Mercedes team-mate Nico Rosberg third.
It was a nightmare race for Hamilton, meanwhile, who saw his engine blow out on lap 41 of the 56-lap race.
Formula 1
Hamilton ahead of 300th Grand Prix: Alonso was my toughest opponent
12/08/2022 AT 09:56
Hamilton exclaimed "No, no, no" after he realised he had suffered the engine failure from first place, 22 seconds ahead.
"I've just got to move on," Hamilton told Sky Sports.
I just can't believe that there's eight Mercedes cars and only my engines are the ones that have gone. Something just doesn't feel right.
Hamilton had been on course to win and reclaim the championship lead as he built up a 22.7s lead over Ricciardo but his engine expired on the approach to Turn 1 with 15 laps to go.

Lewis Hamilton walks away after his engine catches fire at the Malaysian Grand Prix

Image credit: Reuters

The Briton cried "Ah, no, no, no" as he pulled to a stop at the side of the track, climbing out of the car, squatting down and placing his head in his hands.
The virtual safety car was called with Ricciardo, who was running nose-to-tail with Verstappen at the time, pitting along with his Red Bull team-mate for soft tyres as they had a 40-second gap back to Nico Rosberg.
They rejoined comfortably ahead of the German and though Verstappen ran close behind, Ricciardo absorbed the pressure to take his first victory of the season.
After Ricciardo had a chance to celebrate the victory, he made a powerful statement by dedicating the win to the late Jules Bianchi.

Red Bull's Daniel Ricciardo of Australia during the Malaysian Grand Prix

Image credit: Reuters

Additional reporting from Autosport
Formula 1
'My worst fears came alive' - Hamilton reflects on 'disbelief' at 2021 finale
08/08/2022 AT 14:56
Formula 1
Alpine boss open to Ricciardo return after Piastri drama
08/08/2022 AT 08:10