U.S. stocks capped the biggest four-day rally in nine months, as bonds rose worldwide on speculation central banks will act to limit the fallout from the U.K.’s vote to leave the European Union.

The S&P 500 Index has recouped all but about half a percent of the two-day rout triggered by Brexit. European equities pushed their five-day gain past 3 percent for the best week in a month, with the U.K.’s FTSE 100 posting its biggest weekly rally since 2011. Treasury yields fell to record lows along with rates from Spain to Japan as policy makers signaled their readiness to shore up the economy. The pound slid a second day as gold rose a fifth week.

Statements from the European Central Bank and the Bank of England that they stand ready to loosen policy in the aftermath of the Brexit referendum helped halt a two-day rout in markets. Odds that the Federal Reserve will raise borrowing costs this year as planned have fallen to less than 10 percent. Data today showed U.S. factory activity expanded in June at the fastest clip in more than a year, underscoring optimism in the strength of the world’s largest economy as investors look to data for clues on the trajectory of interest rates.

“Central banks coming out and reinforcing that they were a backstop gave investors the confidence that they would have enough support to keep making moves,” said Walter Todd, who oversees about $1.1 billion as chief investment officer for Greenwood Capital Associates LLC in South Carolina. “That and the timing of the quarter-end played into it and helped the rally start and the market really rebound.”

U.S. markets will be closed on Monday in observance of Independence Day, while trading in Treasuries was shut at 2 p.m. Friday in New York, according to the Securities Industry and Financial Markets Association.

Stocks

The S&P 500 added 0.2 percent at 4 p.m. in New York, after briefly almost erasing gains. The gauge’s four-day advance helped it to a third consecutive quarterly gain and the biggest weekly increase since November.

Anxiety continues to ebb with the CBOE Volatility index, known as the VIX, poised for its biggest weekly tumble ever, down 43 percent after a 33 percent jump last week.

“As bad as things have gotten, central banks have talked about new types of easing -- that’s going to keep a bid under equities,” said Andrew Brenner, head of international fixed income at National Alliance Capital Markets in New York. “The worse things get, the more potential there is for quantitative easing and the better that is for equity markets.”

S&P cut its estimate for 2016 U.S. economic growth to 2 percent from 2.3 percent previously, while also trimming its outlook for 2017. “All told, we expect the repercussions from Brexit to weigh somewhat on U.S. GDP,” said S&P’s U.S. Chief Economist Beth Ann Bovino.

The Stoxx Europe 600 Index added 0.7 percent. The U.K.’s FTSE 100 Index rose 1.1 percent, after recovering from its post-Brexit slump to reach its highest level since August on Thursday. It’s up 7.2 percent for the week. Lenders reversed a drop today after the BOE was said to be planning a cut in banks’ capital requirements as early as next week.

The Shanghai Composite Index added 0.1 percent. China’s official factory gauge retreated to the dividing line between improvement and deterioration last month, while a private gauge missed the median economist estimate. A measure of services perked up, underscoring the two-speed pace of growth in the world’s second-largest economy.

Bonds

The yield on 30-year Treasuries slid six basis points at 2.225 percent today after earlier dropping as much as 10 basis points to an unprecedented 2.1873 percent. The rate on 10-year notes dropped three basis points to 1.444 percent.

“The reason is simple: if you’re facing negative interest rates on over 30 percent of government debt, you’re going to go look for where you can get positive rates,” Mohamed El-Erian, the chief economic adviser at Allianz SE and a Bloomberg View columnist, said in an interview with Bloomberg Television. U.S. 10-year yields “can go to 1.25 percent quite easily if we continue to see this combination of more central bank activism and a slowdown in Europe.”

Spanish government securities climbed, pushing two- and 10-year yields to all-time lows. Bonds in Italy, which like Spain has a relatively large debt market compared with the size of its economy, also advanced. Japan’s 10-year yield tumbled to an unprecedented minus 0.255 percent.

Bonds returned 5.8 percent in the first half of the year, according to the BofA Merrill Lynch Global Broad Market Index.

Currencies

The pound fell 0.2 percent to $1.3280, after sliding 0.9 percent Thursday on BOE’s Mark Carney’s comments alluding to potential policy action. Sterling reached a 31-year low of $1.3121 on June 27 in the aftermath of the Brexit vote.

The yen snapped a three-day retreat, climbing 0.6 percent to 102.61 per dollar after a survey showed business confidence in Japan stabilized.

The MSCI Emerging Markets Currency Index was little changed, while up for the week by 1.2 percent. South Africa’s rand and Malaysia’s ringgit strengthened the most on Friday.

Commodities

Silver jumped as much as 6.3 percent, and gold climbed 1.5 percent to $1,341.90 an ounce, as it capped the longest streak of weekly gains since July 2014.

Copper, lead and zinc all rose more than 1.4 percent. The London Metal Exchange LMEX Metals Index rallied the most in two years last quarter.

West Texas Intermediate crude jumped in late afternoon trading to close 1.4 percent higher at $48.99. The commodity surged 26 percent in the three months through June as declines in U.S. supply fueled speculation the global oil surplus is easing.