By Barani Krishnan and Ahmad Ghaddar

NEW YORK/LONDON (Reuters) - Oil prices settled 5 percent lower on Friday after Britain's vote to leave the European Union spurred massive risk aversion and a rally in safe havens like the U.S. dollar that threatened to cut short a three-month-long recovery in global oil markets.

Financial markets have been worried for months about what a British exit from the European Union, dubbed widely as 'Brexit,' would mean for Europe's future, but were clearly not fully factoring in the risk of a 'leave' vote.

The dollar index <.DXY> jumped about 2 percent, its most since 2008, while sterling <GBP=> collapsed to a 31-year low after British Prime Minister David Cameron, who campaigned to remain in the EU, said he would stand down by October. [FRX/]

A rallying dollar makes oil and other commodities denominated in the greenback costlier for holders of the euro and other currencies.

Brent crude <LCOc1> settled down 4.9 percent, or $2.50, at $48.41 a barrel. It had fallen 6 percent earlier to $47.54.

U.S. crude <CLc1> fell 5 percent, or $2.47, to settle at $47.64, its largest one-day decline since February.

The losses were much smaller on the week, with Brent down 1.5 percent and U.S. crude 0.7 percent.

Analysts in oil markets sought to put the Brexit crisis in perspective even as some $2 trillion was wiped off equity bourses worldwide, and money poured into safe-haven gold and government bonds. [MKTS/GLOB]

"This is an historic event and will not be swept under the rug very quickly," said Dominick Chirichella, senior partner at the Energy Management Institute in New York.

"That said, markets will not remain in turmoil as they are at the moment for an extended period of time. There is no indication that the global financial markets are anywhere near a meltdown as we saw in 2008. The UK will not collapse and the EU will not collapse anytime soon."

Despite the retreat, oil prices held above last week's one-month lows when fears of a British exit from the EU spiked and Brent hit a trough of $46.94 while U.S. crude tumbled to $45.83.

Some analysts said oil could face further pressure.

"Our view is that we have not yet seen the low oil price of the day with Brent likely to trade down toward $45 or lower before we have seen the worst of it," said Bjarne Schieldrop, chief commodity analyst at Nordic bank SEB.

Investors paid little heed to data on Friday showing the U.S. oil rig count fell by seven this week, the first weekly reduction in four weeks. [RIG/U]

"Higher risk aversion is likely to make it hard for prices to regain the $50 per barrel mark in anything like the near future," said Carsten Fritsch, analyst at Frankfurt's Commerzbank.

(Additional reporting by Aaron Sheldrick in Tokyo and Florence Tan in Singapore; Editing by Marguerita Choy and Bernadette Baum)