(Reuters) - The Dow and S&P 500 rose on Tuesday as stronger-than-expected results and outlooks from Walmart and Home Depot bolstered views on the health of consumers, while technology shares declined and weighed on the Nasdaq.
The S&P 500 consumer discretionary and staples sectors gave the benchmark index its biggest lift, while the S&P 500 retail index rose 1.9%.
The S&P 500 also came close to breaking above its 200-day moving average, a key technical level. The benchmark index has not closed above that level since early April.
Walmart Inc shares jumped 5.1% after the retailer forecast a smaller drop in full-year profit than previously projected, while Home Depot Inc gained 4.1% after it surpassed estimates for quarterly sales.
At the same time, the 10-year U.S. Treasury yield rose, weighing on technology and other high-growth stocks. Shares of Microsoft Corp were down 0.3% on Tuesday after recent gains.
After a harsh first half of the year, the S&P 500 is up nearly 14% since the start of July, helped in part by better-than-expected earnings from Corporate America.
Investors have also been optimistic lately that 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.
Walmart in July slashed its profit forecast amid surging prices for food and fuel.
The Dow Jones Industrial Average rose 239.57 points, or 0.71%, to 34,152.01, the S&P 500 gained 8.06 points, or 0.19%, to 4,305.2 and the Nasdaq Composite dropped 25.50 points, or 0.19%, to 13,102.55.
With results in from the majority of S&P 500 companies, second-quarter earnings are expected to have risen 9.7% from a year earlier, compared with 5.6% estimated on July 1, according to IBES data from Refinitiv.
Shares of Target Corp, which reports quarterly results early on Wednesday, closed 4.6% higher.
Still, investors will be anxious to see July U.S. retail sales data, which is due on Wednesday as well. Also on Wednesday, the Fed is scheduled to release minutes from its July policy meeting.
Investor sentiment is still bearish, but no longer "apocalyptically" so, according to BofA's monthly survey of global fund managers in August.
Volume on U.S. exchanges was 10.92 billion shares, compared with the 10.96 billion average for the full session over the last 20 trading days.
Advancing issues outnumbered declining ones on the NYSE by a 1.22-to-1 ratio; on Nasdaq, a 1.21-to-1 ratio favored decliners.
The S&P 500 posted 8 new 52-week highs and 29 new lows; the Nasdaq Composite recorded 82 new highs and 40 new lows.