Stocks shrugged off a wobbly start to finish solidly higher on Wall Street Monday, as the market clawed back half its losses from last week.

The S&P 500 rose 1.5% after having been down 0.3%. The market rallied after a much healthier-than-expected report on the housing market put investors in a buying mood. Technology, industrial and communications stocks accounted for much of the market's broad gains. European stocks also closed higher. Treasury yields were mixed and oil prices rose.

Gains for Boeing and Apple in particular helped to lift Wall Street indexes. Boeing jumped 14.4%, its best day in more than two months. The company's troubled 737 Max jet looks set to begin test flights soon. Apple added 2.3% as customers keep buying its products regardless of whether they’re quarantined.

The pickup in U.S. stocks after a weekly loss marks the latest choppy move for markets around the world, which have been swinging back and forth in recent weeks as investors balance hope for a relatively quick economic rebound as more businesses reopen against worry as an increase in confirmed new coronavirus cases forces some businesses to close their doors again.

“It’s just another day of normal volatility, its unfortunately what we’re living with now,” said Mark Litzerman, head of global portfolio management at Wells Fargo Investment Institute. “It tends to be this tug of war between better economic data coming through versus a rise in cases."

The S&P 500 gained 44.19 points to 3,053.24. The Dow Jones Industrial Average rose 580.25 points, or 2.3%, to 25,595.80. The Nasdaq composite added 116.93 points, or 1.2%, to 9,874.15.

Stocks of smaller companies also jumped more than the rest of the market, which often happens when investors are feeling more optimistic about the economy. The Russell 2000 index of small-cap stocks picked up 42.43 points, or 3.1%, to 1,421.21. The index made up for all of its loss from last week.

A rise in infections of the new coronavirus, including in the U.S. South and West, has dented the optimism that earlier sent the S&P 500 screaming nearly all the way back to the record it reached in February.

The worry is that the worsening levels could choke off the budding improvements the economy has shown recently as states and other governments ease up on lockdown orders, even with the Federal Reserve and other central banks pumping unprecedented amounts of aid into the economy.

Florida and Texas put new restrictions on bars to slow the spread of the virus, for example, which helped drive the S&P 500 to a loss of 2.9% last week. Other government around the world are likewise backtracking on efforts to reopen their economies following widespread lockdowns that sent the global economy into a sudden, severe recession.

To see how sharply the economy is swinging, consider Monday's report on the housing market. It showed that the number of Americans signing contracts to buy homes rose a record 44.3% in May from a month earlier. That was more than double the 17% rise that economists were expecting. It was also a whiplash reversal from the record-breaking plunge of nearly 22% that came in April as the pandemic froze the housing market.

The encouraging housing report is likely a sign of pent up demand, considering that spring is the key season for home sales and it was delayed mostly until summer, Litzerman said.

“It is good to see that people are out there buying again,” he said. “The biggest thing is how quickly the consumer comes back and how do they come back.”

Given all the uncertainty about the path for the economy and corporate profits, many professional investors say the only sure thing for markets is that upcoming movements will likely be volatile. The second quarter of the year is set to close out Tuesday, and the S&P 500 is on pace for a gain of more than 18.1%, which would be its best since late 1998. Of course, that follows the U.S. stock market’s loss of nearly 20% in the first quarter, which was its worst since the bottom of the 2008 financial crisis.

The market's gains were widespread Monday, with industrial companies and raw-material producers jumping the highest. Homebuilders also helped lift the market. Hovnanian Enterprises surged 11.9%.

Shopping mall owner Simon Property Group jumped 10.1%. Its shares have risen and fallen for months with expectations of whether people will be able to get closer to “normal” activity.

Stocks of airlines, whose profits are also excruciatingly tied to a reopening economy, were also strong. Southwest Airlines gained 9.6%, American Airlines Group and Alaska Air Group each climbed 7.6%.

Facebook rose 2.1% after shaking off a loss earlier in the morning. It's facing a defection of advertisers tired of the racist and violent posts spreading through the social network. Starbucks on Sunday joined the list of big companies saying it will pause its advertising on social media.

The yield on the 10-year Treasury held steady at 0.63%.

Oil prices rose. Benchmark U.S. crude oil for August delivery rose $1.21 to settle at $39.70 a barrel. Brent crude oil for August delivery rose 69 cents to $41.71 a barrel.