Global markets sagged Friday but still turned in one of the strongest weeks of 2016 despite worries about economic growth and weak commodity prices.
China's intervention to support the yen and scare off devaluation speculators, and a deal struck to possibly avert Britain's pullout from the European Union, reduced some of the risks that had dogged markets for weeks.
But there was still turbulence in the oil market, with prices falling at the end of the week amid doubts over a possible deal between Russia and key OPEC producers to ease the market glut.
US stocks closed lower Friday but racked up their best week of the year, with the S&P 500 climbing 2.8 percent.
London's FTSE index gained 4.3 percent in the week; Tokyo's Nikkei 225 surged 6.8 percent; and the Shanghai Composite rose 3.5 percent after reopening Monday following a week-long Lunar New Year break.
But for Friday alone, European shares were lower as traders waited to see if British Prime Minister David Cameron could strike a deal with his EU counterparts that would give Britain some breaks to encourage it to remain in the 28-country European Union.
London's FTSE 100 index of top companies and Paris' CAC 40 both shed 0.4 percent at the close while the Frankfurt DAX fell 0.8 percent.
A deal was reached late Friday, after the markets closed, giving a slight boost to the euro and the pound against the US greenback. But Cameron still has to sell it to the British public, who will vote in a referendum on "Brexit" likely in June.
"We overcame our differences to reach a good agreement," said Belgian Prime Minister Charles Michel on Twitter. "Now up to British people to decide. Good luck David Cameron."
Earlier, European shares had been in retreat on worries over the talks and how a British exit would play out.
"We are diving into a big sea of unknowns and unknowable risks as we contemplate Brexit," said a note Friday morning from High Frequency Economics.
Apple under fire
On Wall Street, most petroleum-linked equities retreated as oil prices fell. The bigger losers included Apache Petroleum and Continental Resources, both of which dropped about 4.5 percent.
Apple dipped 0.2 percent as US law enforcement officials sought a court order to force it to help unlock an iPhone as part of the probe into last year's San Bernardino attacks, escalating a legal showdown over encryption. Apple on Thursday said it would fight the government's demand.
Republican presidential frontrunner Donald Trump entered the fray Friday, calling for a boycott of Apple until the computer giant complies with US government demands to unlock the iPhone.