(AP) -- Banks and other financial companies led another broad surge in U.S. stocks Wednesday, turning the Dow Jones industrial average and the Standard & Poor's 500 index slightly positive for the year.
It was the second rally in two days for the stock market, which had been rattled since Friday by investor concerns over Britain's vote to leave the European Union.
Those worries eased Wednesday as traders shifted money back into stocks. The gains over Tuesday and Wednesday erased more than half of the losses U.S. markets suffered in the two-day slide that kicked off on Friday.
Britain's stock market has recouped all its losses in the same stretch, but other major markets in Europe and Asia have yet to bounce back fully. Markets in France, Germany, Japan and Hong Kong have gotten back about half the ground they lost; Brazil's has recouped about three-quarters.
"The market has moved from a shock," said Erik Davidson, chief investment officer for Wells Fargo Private Bank. "The worries around 'Brexit' are now moving from short-term worries to long-term worries, and that's why we're seeing this dramatic rebound in the market."
The Dow gained 284.96 points, or 1.6 percent, to 17,694.68. The S&P 500 index rose 34.68 points, or 1.7 percent, to 2,070. The Nasdaq composite added 87.38 points, or 1.9 percent, to 4,779.25.
European stock indexes posted gains that eclipsed Wall Street's for the second day in a row. The British pound edged up against the dollar following its plunge to 31-year lows after the British vote last week.
Britain's benchmark stock index, the FTSE 100, gained 3.6 percent, while Germany's DAX rose 1.7 percent. France's CAC 40 added 2.6 percent.
On Wall Street, financial companies, which had taken the brunt of the selling after the British "leave" vote, rose 2.3 percent. The sector is still down 5.6 percent for the year.
Citigroup jumped 4.2 percent, adding $1.68 to $42.12, while American Express rose $2.02, or 3.5 percent, to $59.63. JPMorgan Chase gained $1.68, or 2.8 percent, to $61.20.
Several oil and gas production and transportation companies also notched gains as the price of crude oil rose sharply. Murphy Oil climbed $1.93, or 6.4 percent, to $32.02. Kinder Morgan rose 82 cents, or 4.6 percent, to $18.53.
The market also got a boost from new data on consumer spending and the latest batch of company deal news.
The Commerce Department said that consumer spending increased 0.4 percent in May on top of a 1.1 percent surge in April. The data underscore that consumer spending, which accounts for about 70 percent of U.S. economic activity, picked up in the spring after getting off to a slow start in 2016.
The Canadian Imperial Bank of Commerce agreed to buy bank holding company PrivateBancorp for $47 per share in cash and stock, or $3.73 billion. News of the deal sent PrivateBancorp shares up 23.3 percent. The stock added $8.36 to $44.29.
Tesaro more than doubled after the drug developer said its targeted pill for recurrent ovarian cancer prevented the disease from worsening for many months after chemotherapy ended. There's no approved maintenance treatment to keep ovarian cancer at bay after chemotherapy. The stock gained $40.19 to $77.40.
Global financial markets were rattled last Friday by the British "leave" vote, which many investors did not seem to anticipate. Stocks and oil fell, as did the pound, while bonds and gold rose thanks to their perceived status as safe havens. Ratings agency S&P slashed its top-shelf credit rating for the U.K.
But the two-day slump broke on Tuesday, as investors appeared to set aside their anxiety over Britain's vote.
In another sign that investors' worries are easing, the VIX, a gauge of expectation of future U.S. stock volatility, fell 11.3 percent Wednesday to 16.6. It had hit 25.8 on Friday.
"The VIX is literally where it was two weeks ago," said Tom Siomades, head of Hartford Funds' Investment Consulting Group. "(Investors) dumped everything on Friday, and when they came back, they realized things aren't as bad and it's going to take a long time to unwind this thing."
Earlier, stock markets in Asia closed broadly.
Japan's Nikkei 225 rose 1.6 percent and South Korea's Kospi gained 1 percent. Hong Kong's Hang Seng index added 1.3 percent, while Australia's S&P/ASX 200 rose 0.8 percent. Stocks in Taiwan, Singapore and Indonesia also were higher.
In currency markets, the British pound recovered some of its losses this week but remained near its 31-year low. It rose to $1.3431 from $1.3343 on Tuesday.
The yen, which strengthened sharply after the British referendum, bounced back after an early slide. The dollar fell to 102.56 yen from 102.79 yen. The euro rose to $1.1106 from $1.1049.
In energy futures trading, benchmark U.S. crude surged $2.03, or 4.2 percent, to close at $49.88 a barrel in New York. Brent crude, used to price international oils, also rose $2.03, or 4.2 percent, to close at $50.61 a barrel in London.
Among metals, gold rose $9 to $1,326.90 an ounce, silver gained 52 cents to $18.41 an ounce and copper added 1 cent to $2.19 a pound.
Bond prices fell. The yield on the 10-year Treasury note jumped to 1.52 percent from 1.47 percent.