In his first victory since 2018, Ricciardo led home team mate Lando Norris in a McLaren one-two, with Valtteri Bottas taking third.
The 32-year-old was helped on lap 26 when championship rivals Max Verstappen and Lewis Hamilton took each other out in a dramatic crash at the first corner.
Both drivers were unhurt, but out of the race, with the stewards set to investigate after the Grand Prix.
It is Ricciardo’s eighth grand prix victory and his first since joining McLaren this season.
Starting second on the grid, Ricciardo got the dream start off the line, taking the lead from Verstappen into the first corner.
What followed was some of the Australian’s best driving of his Formula One career.
“To be honest, even if we got the start, it was never a guarantee we would lead the whole race,” Ricciardo said.
“To lead literally from start to finish, I don’t think any of us expected that.
“I don’t know there was something in me on Friday, I knew something good was to come, so let’s just say that.”
Ricciardo also claimed an additional championship point for the fastest lap of the race, which he secured on the final lap before screaming into his team radio: “Yeah! We won! We did it! Yeah boys!”
He celebrated with his trademark “shoey” on the podium.
The drivers and teams will be back on track at the Sochi Autodrom for the 2021 Russian Grand Prix on September 24 to 26.
The circuit has traditionally been a Mercedes stronghold, with no other team having ever won there in seven attempts.