Traders work on the floor of the New York Stock Exchange (NYSE) in New York City, U.S., January 26, 2022.
Traders work on the floor of the New York Stock Exchange (NYSE) in New York City, U.S., January 26, 2022. Reuters / BRENDAN MCDERMID

U.S. stocks ended higher on Tuesday along with Apple and other technology shares, while Target Corp's disappointing margin forecast weighed on retail stocks for much of the day.

Energy shares also climbed with higher oil prices.

Gains in Apple Inc shares came despite news earlier in the day that the company must change the connector on iPhones sold in Europe by 2024 after EU countries and lawmakers agreed to a single charging port for mobile phones, tablets and cameras. The S&P 500 technology index was also higher.

At the same time, shares of Target Corp fell after the retailer said it would have to offer deeper discounts and cut back on stocking discretionary items.

Equity trading was choppy, with indexes down early in the day, but the market has been recovering from recent steep losses.

Recently, "we've had a nice bounce ... and in general investors are feeling better right now. But we are very much in a seesaw market as we've seen all year," said Tim Ghriskey, senior portfolio strategist at Ingalls & Snyder in New York.

"At some point, we will put in a bottom, and the market will move higher. We have a hard time believing that's any time soon, given a number of fundamental issues overhanging the market," he said. "Certainly what we've seen today from Target isn't good news in terms of the consumer."

According to preliminary data, the S&P 500 gained 38.72 points, or 0.93%, to end at 4,159.85 points, while the Nasdaq Composite gained 110.92 points, or 0.92%, to 12,172.29. The Dow Jones Industrial Average rose 262.86 points, or 0.80%, to 33,178.64.

Some market-watchers have also noted that while clearing inventories would be negative for these companies in the near term, it could eventually help to dampen inflation.

The U.S. consumer price index report due on Friday is expected to show inflation remained elevated in May, though core consumer prices, which exclude the volatile food and energy sectors, likely ticked down on an annual basis.

Among the day's gainers, Kohl's Corp shares jumped after news the department store chain entered exclusive talks with retail store operator Franchise Group Inc over a potential sale that would value it at nearly $8 billion.