The evergreen 38-year-old beat compatriot Danilo Petrucci, on a non-works Octo Pramac Ducati, to second place by a mere 0.063 with rain midway through the race making conditions tricky.
Triple world champion Marc Marquez was third for Honda.
Rossi has now been a winner across all classes for longer than any other rider in the history of motorcycling, Sunday's victory coming 20 years and 313 days since his first in what was then the 125cc category.
Grand Prix Valencia
'An inspiration for me' - Federer leads Rossi tributes after final race
14/11/2021 AT 17:23
He now has 115 grand prix wins across all classes, second only to compatriot Giacomo Agostini's 122 victories between 1964 and 1977.
Fellow-Italian Andrea Dovizioso finished fifth for Ducati to take over at the top of the standings, four points clear of Yamaha's Spaniard Maverick Vinales who crashed out. Rossi is third overall, seven points off the lead.
The victory was Rossi's 10th at Assen but first since the Catalan Grand Prix in Barcelona on June 5 last year.

Valentino Rossi of Italy and Movistar Yamaha MotoGP leads the field at Assen

Image credit: Getty Images

Rossi announces decision to retire at end of season
05/08/2021 AT 14:45
Valentino Rossi tests positive for Covid-19
15/10/2020 AT 17:16