The race was stopped with eight laps to go as rain arrived. Marquez had passed Espargaro and rapidly built a lead when the red flags flew, but with the race being reset one lap it was the Pons man who was handed victory.
Espargaro had only come to the fore late on in a race in which the leader was never able to build a clear advantage as Thomas Luthi (Paddock Suter), Marquez (Monlau Suter), Scott Redding (Marc VDS Kalex) and Espargaro all took turns at the front.
Redding was the star early on, working his way through from 12th on the grid to capture the lead from Luthi when the Swiss rider made a mistake on lap seven.
His spell at the front lasted just four laps - during which he was passed by and then repassed Marquez - before Luthi outdragged him down into Turn 1. Redding then dropped back, eventually finishing fourth - like Espargaro gaining one position on countback.
Out front Luthi fell victim to a decisive but fair pass by Marquez going into the final turn of lap 15, which forced him wide and allowed Espargaro to come through into second.
Espargaro then shadowed Marquez for two more laps before diving past on lap 17. His lead lasted all of one lap - Marquez coming through at the start of the 18th – but his timing was impeccable as the race was called early, handing him victory.
Luthi finished third ahead of Redding and Kalex's Takaaki Nakagami, who had been closing on the lead quartet until rain started to fall.
Claudio Corti finished seventh, ahead of Mika Kallio – the latter having been part of the lead battle until running wide and through the gravel on lap 13.
Dominique Aegerter (Technomag-CIP Suter), Toni Elias (Aspar Suter) and Johann Zarco (JIR Motobi) rounded out the top 10.