EMERGING MARKETS-Mexico markets rise after cenbank's aggressive hike

(Updates prices, recasts with Mexico central bank)

MEXICO CITY, June 30 (Reuters) - Mexico’s peso firmed sharply on Thursday after the central bank surprised the market with an aggressive interest rate hike to protect the beleaguered currency and calm concerns that its weakness could stoke inflation.

The Banco de Mexico raised its key rate by half a percentage point to 4.25 percent, above the 25 basis-point hike projected by the median of analysts surveyed by Reuters.

The peso has been buffeted by global volatility in recent months and slumped more than 7 percent in May, its worst monthly loss in four years. Last week’s surprise vote by the United Kingdom to leave the European Union drove the currency to a record low.

But the peso reversed losses after the rate increase and ended the day up 1.11 percent at 18.2745 pesos per dollar.

The IPC index, sharply paired gains after the decision but rallied back to close up 1.1 percent, as shares in miners Grupo Mexico, up 3.93 percent, and Penoles , up 7.8 percent, drove gains.

Amid global economic uncertainty following the shock Brexit vote, mining stocks have notched considerable gains as investors seek a safe haven in gold. Shares in Penoles, which runs the world’s largest primary silver producer, Fresnillo, have risen 25 percent since last Friday.

In Brazil, the real strengthened for a third straight day on Thursday. The real has benefited from a rebound in global risk appetite, which drove the currency past 3.20 per U.S. dollar for the first time in almost a year. The real ended June up 11.05 percent, its biggest monthly gain in 13 years.

Recovering global investor sentiment also lifted Brazil’s Bovespa stock index, which ended the day up 1.03 percent. (Reporting by Gabriel Stargardter and Bruno Federowski in Sao Paulo; Editing by Chris Reese)