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 rose in afternoon trading on Tuesday along with gains in Apple and other technology shares, while Target Corp's disappointing margin forecast weighed on retail shares.

Energy shares also climbed with higher oil prices.

Apple Inc shares were up 1.8%. The gains 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 up 1%.

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

Trading was choppy, but indexes have been recovering from recent steep losses. The S&P 500 remains down about 13% for the year so far.

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."

The Dow Jones Industrial Average rose 168.31 points, or 0.51%, to 33,084.09, the S&P 500 gained 26.99 points, or 0.65%, to 4,148.42 and the Nasdaq Composite added 84.61 points, or 0.7%, to 12,145.98.

Walmart Inc shares were down 1.7%, while the S&P retail index was also down 1.7%.

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 were up 9% 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.

Advancing issues outnumbered declining ones on the NYSE by a 1.77-to-1 ratio; on Nasdaq, a 1.55-to-1 ratio favored advancers.

The S&P 500 posted 3 new 52-week highs and 30 new lows; the Nasdaq Composite recorded 30 new highs and 115 new lows.