U.S. stocks rose Tuesday, pushed higher by gains in economically sensitive stocks, as new data revealed strong consumer confidence in the U.S. economic recovery.

The S&P 500 added 0.1%, on pace to notch a new record high, as shares of energy stocks, homebuilders and other economically sensitive companies rallied. The Dow Jones Industrial Average added about 75 points, or 0.2%.

The Nasdaq Composite, in contrast, wobbled between gains and losses, recently hovering near the flatline, as many of the megacap technology stocks that drove Monday’s gains pulled back. Facebook, which closed Monday with a market capitalization above $1 trillion for the first time, fell 1.8%.

Driving Tuesday’s gains in cyclical stocks was data from private research group The Conference Board, which showed its index of consumer confidence rose in June, beating analysts’ expectations. Additional data released Tuesday also showed that home-price growth climbed to a record high in April.

Shares of homebuilders including PulteGroup and Lennar each rallied nearly 2% or more.

Stocks have climbed in recent weeks—with the S&P 500 and Nasdaq Composite hitting fresh highs Monday—propelled by investors’ confidence in the economic recovery and the prospect of fresh government spending. Money managers remain cautious about whether highly infectious variants of Covid-19 could slow the global economic recovery or disrupt supply chains for crucial goods.

Still, most analysts expect stocks to grind higher.

“We have further to run when it comes to equities, but I think there is some form of summer lull coming and it could be that we see some zigzagging,” said Daniel Egger, chief investment officer at St. Gotthard Fund Management, about small potential market peaks and valleys.

“I wouldn’t be surprised to see an air pocket coming when markets pull back a little.”

In corporate news, Morgan Stanley rose 4%. The bank on Monday doubled its quarterly dividend and said it plans to buy back up to $12 billion of its stock. Goldman Sachs gained 1.9% after raising its dividend.

Shares of energy companies also jumped higher, with Occidental Petroleum gaining 3.2%, while Hess gained 1.4%.

Brent crude, the international oil benchmark, rose about 0.6% to $74.56 a barrel. The Organization of the Petroleum Exporting Countries and its allies are meeting Thursday, where they are expected to discuss a modest boost in production.

In bond markets, the yield on the benchmark 10-year U.S. Treasury note edged up to 1.487%, from 1.478% on Tuesday. Yields rise when bond prices fall.

Overseas, the Stoxx Europe 600 rose 0.4%.

Japan’s Nikkei 225 fell 0.9% by the close of trading, while the Hang Seng Index dropped 0.9%. In mainland China, the Shanghai Composite Index fell 0.9%.

A trader stood outside of the New York Stock Exchange on Monday.

A trader stood outside of the New York Stock Exchange on Monday.

Photo: andrew kelly/Reuters

Hardika Singh contributed to this article.