Dovizioso passed long-time leader Alex Rins twice - once before the 40-minute red-flag stoppage and once after - en route to his fourth win of the campaign.
Behind the race winner, a late crash for Valentino Rossi handed Pol Espargaro and KTM their first respective podiums in the premier class, having remounted after an earlier off.
The track was wet but drying as riders set about their sighting laps out of the pits, but soon after they spread around the grid in preparation for the start the rain made its return, soaking the circuit once more.
The race began as scheduled, and surprise poleman Maverick Vinales did not keep his lead for long at the start, slipping behind Rins and Dovizioso off the line, although he would re-pass the latter into Turn 2.
But the Yamaha rider did not have the pace to stay in the fight and by the time Dovizioso retook the spot on the main straight a lap later, Rins was already two seconds clear.
L'esultanza di Andrea Dovizioso per il successo a Valencia, Getty Images
Image credit: Getty Images
He doubled his lead over Dovizioso in the next few laps, before the conditions took a turn for the worse and riders began to crash out en masse.
Danilo Petrucci, running fifth, was caught out by conditions and dropped out of his final race with Pramac, while his team-mate Jack Miller had suffered his fifth crash of the weekend a few laps earlier.
Ducati wildcard Michele Pirro also hit the deck, as did KTM rider Espargaro, who had made a brilliant start and was fighting Marc Marquez for third when he went down.
But Marquez himself only lasted a few corners more, the champion suffering a highside through Turn 9, which was then followed by a similarly violent crash for Suzuki's Andrea Iannone.
A few laps later, by when both Vinales - through the high-speed Turn 14 - and Marc VDS rider Franco Morbidelli had crashed out of the top five, Rins was noticeably struggling - and he was swiftly reeled in by Dovizioso and a charging Rossi.
The Suzuki rider ran wide, allowing both through, and after holding off an attack from Rossi and beginning the 15th lap of 27 in the lead, Dovizioso raised his hand, pleading for the race to be stopped.
The red flags followed moments later, and the race order was rolled back to lap 13 for when the race resumed in more manageable conditions.
Rins held the lead off the line, but was passed by Dovizioso on the main straight the next time by, with the pair once more joined by Rossi as they pulled away from the pack.
Andrea Dovizioso, Alex Rins, Valentino Rossi, Getty Images
Image credit: Getty Images
But Rins could only keep with Dovizioso for a few laps, soon slipping behind Rossi, who couldn't live with the leader's pace either and crashed at Turn 12 with five laps left to run.
Dovizioso and Rins took the chequered flag 2.750s apart, while Espargaro and Pirro completed the top four, having remounted after their pre-red-flag crashes before carving their way through the pack after the restart.
Dani Pedrosa bowed out of MotoGP with a fifth-placed finish, ahead of fellow Honda rider Takaaki Nakagami, 2018's top independent rider Johann Zarco and Espargaro's KTM team-mate Bradley Smith, who had also crashed before the stoppage.
Hafizh Syahrin was ninth but couldn't overhaul Morbidelli to finish as the campaign's top rookie, while Cal Crutchlow's LCR stand-in Stefan Bradl made up the top 10.
Scott Redding finished his final planned MotoGP race in 11th ahead of a cautious Jorge Lorenzo and the damaged Yamaha of Rossi, while World Superbikes-bound Alvaro Bautista - the only rider besides Rossi to crash in the second half - took 16th and last.