Valentino Rossi marked his 250th premier class Grand Prix by winning the Australian MotoGP on Phillip Island.
The 35-year-old Italian, who is second in the championship standings, won the 27-lap race from eighth on the grid.
World champion Marc Marquez looked to be coasting to victory when he went off on a corner with 10 laps remaining.
Bradley Smith was third, his first podium finish, after fellow Briton Cal Crutchlow crashed out on the final lap when sitting second.
Marc Marquez (Spa) Repsol Honda 312 points
Valentino Rossi (Ita) Yamaha 255points
Jorge Lorenzo (Spa) Yamaha 247 points
Dani Pedrosa (Spa) Repsol Honda 230 points
Andrea Dovizioso (Ita) Ducati 166 points
That completed the first all-Yamaha podium since Le Mans 2008.
An emotional Smith, who has been on the rostrum 23 times in the smaller classes of motorsport, is in only his second year of MotoGP and the 23-year-old said of his third place: "It's unbelievable."
Rossi finished 10 seconds ahead of Spain's Jorge Lorenzo to secure his sixth win in Australia, and first since 2005.
It was the 108th victory of the Yamaha rider's career - and his 82nd in MotoGP or its predecessor 500cc class, which is the most by any rider.
Dani Pedrosa, joint second with Rossi in the standings going into the race, retired due to bike damage after being clipped by Andrea Iannone.
Marquez, who won the world title in Japan last week, was attempting to equal Mick Doohan's 1997 record of 12 premier-class GP wins in a single season and was four seconds clear when he slid off on lap 18.
He was not seriously injured and said of his crash: "I don't know what happened. I was pushing all the time."
The penultimate race of the season takes place in Malaysia next Sunday.
Australian MotoGP result:
1. Valentino Rossi (Ita) Yamaha 40:46.405
2. Jorge Lorenzo (Spa) Yamaha 40:57.241
3. Bradley Smith (GB) Yamaha 40:58.699
4. Andrea Dovizioso (Ita) Ducati 41:01.298
5. Hector Barbera (Spa) Avintia 41:16.494
6. Alvaro Bautista (Spa) Honda 41:16.559
7. Scott Redding (GB) Honda 41:16.563
8. Hiroshi Aoyama (Jpn) Honda 41:19.571
9. Alex de Angelis (Smr) Yamaha 41:19.982
10. Nicky Hayden (US) Honda 41:20.549