Francesco Bagnaia has been crowned MotoGP world champion for a second successive year with victory in Valencia after title rival Jorge Martin crashed out of the finale.
Martin, who started from sixth place on the second row, shot into second place behind Bagnaia on the opening lap at the Ricardo Tormo circuit.
The Pramac Ducati rider was lining up a pass on Bagnaia for the lead into Turn 1 at the start of the third lap when he misjudged the move and clipped the rear of the factory Ducati, narrowly averting disaster.
Martin, though, ran straight on as a result and lost several positions, crossing the line in eighth at the end of the lap.
Trailing Bagnaia by 14 points going into the last race of the 2023 campaign, Martin's task was now seemingly insurmountable but his slim hopes of claiming the title were finally ended when another mistake caused him to collide with Marc Marquez's Repsol Honda, sending both riders tumbling into the gravel on the sixth lap.
A dejected Martin was quickly up on his feet but Marquez, who was hurled into the air and landed awkwardly, had to be helped away by marshals. The incident was due to be reviewed following the race.
Bagnaia won an incident-filled race after repelling a late charge from the revitalised Fabio Di Giannantonio (Gresini Ducati) and Pramac Ducati's Johann Zarco.
He becomes the third rider to secure back-to-back titles since the MotoGP era began in 2002, along with Valentino Rossi and Marc Marquez.
With 18 premier class wins, all achieved with the Italian manufacturer, Bagnaia is second on the list of Ducati riders with the most victories in the premier class behind Casey Stoner (23).
The pressure was off Bagnaia with the championship outcome decided after Martin's demise, and Brad Binder took over the lead on the sixth lap, with his Red Bull KTM team-mate Jack Miller soon following through.
Binder continued to set the pace until Lap 14 when an unforced error led him to run wide and he dropped to sixth.
Miller found himself in the lead with a gap of 1.3s over world champion Bagnaia, with Zarco now in podium contention in third.
Binder was desperate to make amends but the South African was penalised with a drop of one position after he rammed into Gresini Ducati's Alex Marquez.
There was more drama when race leader Miller lost the front of his KTM at Turn 11 on Lap 19, bringing his prospects of a season-ending victory to an abrupt conclusion.
That left Bagnaia with a slender cushion of 0.344s over Zarco, although Binder – who had worked his way back up to third – had the leaders in his sights with six laps of the 27-lap race to go.
Di Giannantonio was close behind Binder in fourth with team-mate Alex Marquez and Aleix Espargaro (Aprilia Racing) the top six.
As Binder's challenge faltered, Di Giannantonio was on the move and he overtook the KTM rider on Lap 23 and began his pursuit of Zarco in second, who was 1.1s ahead.
On the penultimate lap, Di Giannantonio edged past Zarco and was now gunning for long-time race leader Bagnaia.
However, Bagnaia mounted a robust defence to protect his lead on the last lap and closed out a hard-earned victory to celebrate retaining the premier class title in fitting style.
Zarco bagged the last rostrum place behind Di Giannantonio, with the trio covered by three tenths of a second at the finish.
Binder was two seconds back in fourth ahead of RNF Aprilia's Raul Fernandez and Alex Marquez.
Franco Morbidelli (Monster Energy Yamaha), Aleix Espargaro, Luca Marini (VR46 Ducati) and Viñales completed the top 10.
Fabio Quartararo finished 11th on the factory Yamaha ahead of Japan's Takaaki Nakagami (LCR Honda).
In a race of attrition, cool track temperatures caught out a raft of riders, with eight fallers in total including Marco Bezzecchi, Martin, Marc Marquez, Miller, Enea Bastianini, Alex Rins, Augusto Fernandez and Pol Espargaro.