By Caroline Valetkevitch

NEW YORK (Reuters) – The Dow and S&P 500 closed higher on Tuesday as Walmart and Home Depot gained following stronger-than-expected results and outlooks, while technology shares declined and weighed on the Nasdaq.

The S&P 500 consumer discretionary and staples sectors rose sharply along with the S&P 500 retail index.

Walmart forecast a smaller drop in full-year profit than previously projected, while Home Depot surpassed estimates for quarterly sales.

The 10-year Treasury yield rose, weighing on technology and other high-growth stocks.

After struggling for most of the first half of the year, stocks have bounced since mid-June, helped in part by better-than-expected earnings from Corporate America.

Investors have also been optimistic the Federal Reserve can achieve a soft landing for the economy as it tightens policy and raises interest rates to reduce decades-high inflation.

“When you transition from a bear market to a bull market, especially one where the Fed is raising rates and there are concerns over the consumer, you really want to see consumer discretionary underpinned by enthusiasm. And today’s move in discretionary names is positive for the market,” said Quincy Krosby, chief global strategist for LPL Financial in Charlotte, North Carolina.

According to preliminary data, the S&P 500 gained 8.64 points, or 0.20%, to end at 4,305.78 points, while the Nasdaq Composite lost 25.22 points, or 0.19%, to 13,103.14. The Dow Jones Industrial Average rose 239.46 points, or 0.72%, to 34,151.90.

Traders are now seeing a 60% chance of a 50 basis-point hike by the U.S. central bank in September and a 40% chance of a 75 basis-point hike. [FEDWATCH]

Investor sentiment is still bearish, but no longer “apocalyptically” so, according to BofA’s monthly survey of global fund managers in August.

(Reporting by Caroline Valetkevitch in New York; Additional reporting by Bansari Mayur Kamdar, Susan Mathew and Anisha Sircar in Bengaluru; Editing by Anil D’Silva and Matthew Lewis)