Alonso, driving for Ferrari, was able to take advantage of wet course conditions after the race was stopped for about an hour because of rain to build a lead. Perez challenged, however, until he ran wide off course on a turn in the 51st lap and dropped 5 seconds behind the leader.
That edge was enough for Alonso, even with Perez closing fast, to end up winning by 2.2 seconds. His total of 28 Grand Prix victories is fifth-most all-time.
Alonso finished the 56-lap, 193-mile race in 2 hours, 44 minutes, 51.812 seconds. Perez, driving for Sauber-Ferrari, was second and McLaren Mercedes' Lewis Hamilton was third, another 12.3 seconds off the pace. Hamilton had started in the pole position.
Two-time driving champion Sebastian Vettel, also from Red Bull, was 11th. It was just the second time he finished without a drivers' point in 23 races. He was in contention until a left tire puncture in the 48th lap dropped him back.
Alonso, who won the drivers' points championships in 2005 and 2006, leads the 2012 standings with 35 points. Hamilton is second with 30 followed by teammate Jenson Button with 25.
The next stop for the Formula 1 circuit is the Chinese Grand Prix in Shanghai on April 15.
Swim Week Miami Beach 2014 [PHOTOS]