FILE - This is Tuesday, Feb. 16, 2016 file photo of the EU, right, and the British flags as they are placed next to each other at EU headquarters in Brussels. Nearly 1,000 British nationals who work for the European Union's executive have been assured their jobs are safe. ? (AP Photo/Geert Vanden Wijngaert , File )

(AP) — U.S. stock indexes mounted a broad comeback Tuesday as investors set aside their anxiety over Britain’s vote to leave the European Union and snapped up shares following a two-day rout.

Encouraging data on the U.S. economy and housing market helped put traders in a buying mood. The broad rally followed even bigger gains in Europe, which also bounced back from the steep losses triggered by Britain’s “leave” vote last Thursday.

Oil and gas companies led the rally as energy prices rose. Banks and other financial companies, which took the heaviest losses in the sell-off, also surged. Health care, consumer and technology stocks also notched gains. Bond prices fell, sending yields higher.

“We were due for a bounce heading into the morning; we had a couple of tough days there,” said Sean Lynch, co-head of global equity strategy at Wells Fargo Investment Institute. “Investors are stepping up and seeing some areas that may have been oversold the past couple of days and redeploying some of their cash.”

Despite the rebound, the three indexes remain on track to end June in the red. They’re also down for the year.

European benchmarks had an even better day than U.S. indexes. Britain’s FTSE 100 and France’s CAC 40 each gained 2.6 percent. Germany’s DAX added 1.9 percent.

The euro and the British pound recovered somewhat, though the pound remained near the 30-year lows it plunged to immediately following the British “leave” vote.

Uncertainty and anxiety over the economic fallout from Britain’s vote to leave the European Union had roiled global financial markets since Friday and prompted ratings agencies to slash their top-shelf credit rating for the U.K.

Investors appeared to shake off their some of their jitters Tuesday. British Prime Minister David Cameron signaled he might not trigger a clause setting in motion the U.K.’s exit from the EU before October.

In the U.S., investors got a batch of encouraging economic data to consider.

The Commerce Department raised its estimate of U.S. economic growth in the first three months of the year. Separately, a key gauge of home values showed U.S. home prices climbed in April, hitting record highs in several cities. In addition, the Conference Board said its measure of U.S. consumer confidence increased this month to the highest level since October.

“Obviously, the market isn’t very receptive to uncertainty, but in some ways this uncertainty is providing the possibility and the consideration that what happened in the U.K. isn’t necessarily reflective of, or an indicator of, a recession, especially here in the U.S. as well as globally,” said W. Janet Dougherty, a global investment specialist at J.P. Morgan Private Bank.

Pharmaceutical company Endo International surged 18.3 percent, the biggest gainer in the S&P 500 index. The stock added $2.50 to $16.19.

Xencor vaulted 32.1 percent after the drugmaker announced a partnership with Novartis to develop two cancer drugs. The stock rose $4.02 to $16.56.

Earlier in Asia, markets bounced back from early losses as leaders signaled they were ready to step in with support policies. Japan’s benchmark Nikkei 225 index climbed 0.1 percent, while South Korea’s Kospi added 0.5 percent.

Hong Kong’s Hang Seng Index was a laggard, losing 0.3 percent. It was dragged down by companies with high exposure to Europe, such as billionaire tycoon’s Li Ka-shing’s CK Hutchison Holdings, which has British retail, ports and telecom investments and fell 1.7 percent.

In currency markets, the pound recovered to $1.3343 from $1.3176 on Monday. The yen eased slightly against the dollar, though it was still hovering near its strongest level in two years. The dollar rose to 102.79 yen from 101.97 yen. The euro strengthened to $1.1049 from $1.1005.

Benchmark U.S. crude rose $1.52, or 3.3 percent, to close at $47.85 a barrel in New York. Brent crude, used to price international oils, gained $1.42, or 3 percent, to close at $48.58 a barrel in London.