Andrea Dovizioso, who won the previous two races in Austria and at Silverstone to take over the championship lead, completed the rostrum in third place, a long way back on the factory Ducati.
His team-mate, Jorge Lorenzo, made a lightning start from the second row and soon broke away at the front, opening a gap of almost two seconds before he came off at turn 6 on the seventh lap.
Pole man Maverick Vinales had a lonely ride to fourth on the Movistar Yamaha to keep his title hopes alive, but Dani Pedrosa’s championship prospects would appear to be over as the Honda rider struggled to 14th place.
Marquez goes to the top of the championship standings on the count-back but shares the lead with Dovizioso on 199 points. Vinales is now 16 points adrift in third, with Valentino Rossiremaining in fourth on 157 points, despite missing his home race through injury. Pedrosa is one point behind Rossi in fifth after the Spaniard was never able to get to grips with the conditions at the Marco Simoncelli Circuit.
After Lorenzo’s spill, Petrucci – who started from eighth on the grid – inherited the lead from Marquez and Dovizioso, who was riding with the aerodynamic fairing on the GP17 after using the standard version in qualifying.
Britain’s Cal Crutchlow had been lying in fifth place when he came off the LCR Honda almost at the same time as Lorenzo, albeit in a separate incident. Crutchlow remounted and would eventually cross the line in 13th place.
Baz also fell foul of the conditions as he fell at turn 8 while holding eighth place.
Marquez made a signal to his team with his foot as he flashed across the line and his second bike was prepared with a dry set-up, but there was never any real prospect of a changeover as the track remained predominantly wet throughout the 28-lap race.
It seemed as though Dovizioso was poised to challenge Petrucci and Marquez as he closed right in on the leading duo at the half-way point, but the Italian rider was unable to match their pace in the closing stages and he dropped out of contention into an isolated third place ahead of Vinales.
Petrucci continued to set the pace but Marquez began to weigh up a pass on the final laps and was particularly strong in the last sector.
With the last lap approaching, Marquez closed onto the rear of Petrucci’s Ducati and gained excellent drive out of the final corner onto the start/finish straight. He drew alongside Petrucci before taking the lead of the race for the first time into turn 1 at the beginning of the last lap.
Petrucci attempted to strike back immediately, but Marquez had his line covered and within a few corners, he had opened an advantage. The reigning world champion increased his lead to win by 1.1 seconds from Petrucci, with Dovizioso 11.7 seconds back in third.
Pirro rode a strong race to finish fifth behind Vinales, with Aussie Miller, Scott Redding on the second Pramac Ducati and Alex Rins (Ecstar Suzuki) completing the first eight.
Andrea Iannone retired from the race on the Ecstar Suzuki, with reports later claiming he was experiencing arm pump.
Frenchman Johann Zarco pushed his Tech 3 Yamaha over the line to secure the final point in 15th place after he fell from eighth place at the last corner on the final lap.