Dovizioso's win was Ducati's third in succession - the first time the Italian marque has taken a hat-trick since 2008 - as he carved his way from fourth on the grid in the opening laps before setting a pace his opponents were unable to match.
Lorenzo and Marquez managed to close the gap in the latter stages until the former slid out at the Turn 8 left-hander on the penultimate lap, which left Dovizioso with a clear run to victory.
Valentino Rossi tests positive for Covid-19
Poleman Lorenzo hung onto the lead in the opening sequence of corners ahead of fellow front-row starter Jack Miller, as Marquez jumped to third ahead of Dovizioso.
But by the end of the lap Dovizioso had cleared both Marquez and Miller to move into second, and on the sixth lap of 27 he eased past Lorenzo on the run down to Turn 8 to take command.
By that time, Miller had crashed out of what had become fourth, leaving the leading trio with a significant gap over the rest.
Dovizioso's lead was hovering at less than a second until he set a new fastest lap on lap nine, and five laps later his advantage had grown to nearly two seconds.
Andrea Dovizioso (Ducati Team) - GP of San Marino 2018
Image credit: Getty Images
Marquez and Lorenzo, engaged in a thrilling scrap over second, edged back towards Dovizioso in the final five laps but the Italian was able to stabilise his gap and finally take the chequered flag by 2.8s after Lorenzo's crash.
Lorenzo's crash, allied to Dovizioso's win, enabled the Italian to emerge as Marquez's closest challenger in the championship, albeit the duo split by a sizeable 67 points.
Behind Marquez, LCR Honda's Cal Crutchlow - who ran a lonely fourth for most of the race - was promoted to the final podium spot, a further 4s down on Marquez, followed by Suzuki man Alex Rins.
Yamaha's Maverick Vinales failed to make the most of his front-row starting spot, slipping to fifth on the opening lap and ultimately ending up in the same position.
Image credit: Getty Images
Team-mate Valentino Rossi had a similarly indifferent run to seventh behind the second works Honda of Dani Pedrosa.
Andrea Iannone (Suzuki), Alvaro Bautista (Nieto Ducati) and Johann Zarco (Tech 3 Yamaha) completed the top 10.
Rounding out the scorers were Aprilia's Aleix Espargaro and Ducati wildcard Michele Pirro, while Lorenzo remounted to finish 17th - one place ahead of Miller.
The other retirees were Xavier Simeon (Avintia Ducati) and Stefan Bradl (Honda), both crashing out, while KTM's Pol Espargaro was forced to retire a little beyond half-distance.
Debutant Christophe Ponsson (Avintia) finished a lapped 23rd.
Quartararo wins Catalunya MotoGP to reclaim championship lead
Razgatlioglu sets fastest free practice time at Acerbis Catalunya