By Caroline Valetkevitch
NEW YORK (Reuters) - U.S. stocks rallied late on Tuesday to end higher for a second straight day as technology and energy shares gained, while Target Corp's warning about excess inventory weighed on retail stocks for much of the session.
Apple Inc shares climbed 1.8% 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 rose 1% and gave the benchmark index its biggest boost. Microsoft Corp shares added 1.4%.
The S&P 500 energy sector index jumped 3.1% to end at its highest level since 2014, with oil prices sharply higher.
At the same time, shares of Target Corp fell 2.3% 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."
Long-dated U.S. Treasury yields tumbled after the Target news, however, as it fueled some speculation that the worst of inflation may be in the past.
The Dow Jones Industrial Average rose 264.36 points, or 0.8%, to 33,180.14, the S&P 500 gained 39.25 points, or 0.95%, to 4,160.68 and the Nasdaq Composite added 113.86 points, or 0.94%, to 12,175.23.
Shares of Walmart fell 1.2%, and the S&P retail index was down 1%.
Consumer price data on Friday is expected to show that inflation remained elevated in May, though core consumer prices, which exclude the volatile food and energy sectors, likely ticked down on an annual basis.
Not all retailers were in the red. Kohl's Corp shares jumped 9.5% 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 2.36-to-1 ratio; on Nasdaq, a 1.69-to-1 ratio favored advancers.
The S&P 500 posted 3 new 52-week highs and 30 new lows; the Nasdaq Composite recorded 35 new highs and 121 new lows.
Volume on U.S. exchanges was 10.38 billion shares, compared with the 12.50 billion average for the full session over the last 20 trading days.
(Reporting by Caroline Valetkevitch in New York; Additional reporting by Devik Jain, Susan Mathew, Mehnaz Yasmin in Bengaluru; Editing by Maju Samuel and Matthew Lewis)