Diogo Moreira held off David Alonso to secure an emphatic maiden Moto3 victory in a breathless Indonesian Grand Prix encounter that saw Jaume Masia extend his series lead.
Pole-man Moreira led early on having made a good start and fought within the lead pack across the entirety of the 20-lap contest, though his job was made harder as the race entered its closing stanza due to a mistake at Turn 9.
The MT Helmets-MSI rider was forced to run through the run-off area and dropped to seventh as a result, forcing him to recover ground in the closing laps.
A bold move by Daniel Holgado on title rival Masia helped keep Moreira in the fight though as they both ran wide and dropped outside the top five, Moreira putting himself in position to lead onto the start of the final tour.
He came under attack from Holgado and lost the lead in the early part of the lap but managed to sneak back through with just a handful of bends remaining.
The Brazilian rode a perfect defensive line as Alonso looked every which way to find a way past, leaving him to take the chequered flag first for the first time in his Moto3 career by just 0.107s.
David Munoz navigated the final circulation well to secure the final spot on the rostrum, while Colin Veijer ended up as the only Husqvarna in the points as championship contender Ayumu Sasaki endured a tough Sunday in Indonesia.
The Japanese ace crashed on the way to the grid and sustained damage to his Honda and his leathers, Sasaki taking the start with the spare gloves of Moto2 rider Jake Dixon due to not having bedded in his own set of spares.
He struggled to make much ground having dropped to 24th on the opening tour with a slow start, Sasaki coming home a distant 19th in the end and thus breaking an unbroken points run that goes back to the United States GP back in April.
Meanwhile, Jose Antonio Rueda rose to fifth due to a clever final lap, while Masia was battered down to a sixth-place finish in the end.
The Leopard rider still extended his points advantage out to 16 over Sasaki, with Holgado a further point adrift after being dropped to 14th in the final classification due to receiving his second long lap of the race for cutting Turn 9.
Taiyo Furasato ran well to claim seventh for Honda Team Asia, while Deniz Oncu had a quiet race en route to eighth.
Ivan Ortola managed to overcome a double long-lap punishment for a jump start to salvage ninth in the final reckoning. At the same time, Angeluss MTA team-mate Stefano Nepa completed the top ten having served a long lap of his own in the early stages.