Terol continued to lead until lap 18 of 23, when Zarco moved ahead - then appeared to sit up and hand the advantage back to Terol.
The cat-and-mouse continued until Terol retook the lead along the home straight at the start of the penultimate lap, when both riders began pushing flat out.
Terol was still leading as the final lap began, but was passed by Zarco early in the lap.
Terol then squeezed inside Zarco at Turn 14 and pushed them both wide. Zarco held on around the outside and looked to have done enough to win.
Joining them on the podium was Vazquez, who finished 4.932sec from victory.
1. Terol (Aprilia) 23 laps
2. Zarco (Derbi) +0.022s
3. Vazquez (Derbi) +4.932s
4. Cortese (Aprilia) +9.322s
5. Faubel (Aprilia) +9.964s
6. Kent (Aprilia) +12.100s
7. Vinales (Aprilia) +12.324s
8. Gadea (Aprilia) +12.556s
9. Folger (Aprilia) +21.489s
10. Oliveira (Aprilia) +30.678s
21. Webb (Mahindra) +1m 8.795s
22. Mackenzie (Aprilia) +1m 8.846s
Stafford (Aprilia) DNF