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.
Rossi announces decision to retire at end of season
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
Valentino Rossi tests positive for Covid-19
Quartararo wins Catalunya MotoGP to reclaim championship lead