U.S. stocks turned around early losses on Wednesday on positive economic data, even as their European counterparts struggled on the region's debt crisis and an EU agreement to ban Iranian oil imports boosted crude.

Key U.S. stock indexes reversed course after data showed new orders for U.S. factory goods rose solidly in November. But the data also showed business capital spending is cooling.

The market is still teetering between European concerns and better economic data here in the U.S., so I'm not surprised to see this kind of volatility, said King Lip, chief investment officer at Baker Avenue Asset Management in San Francisco.

The Dow Jones industrial average rose 0.13 percent, the Nasdaq Composite Index gained 0.09 percent and the Standard & Poor's 500 Index advanced 0.03 percent. All three indexes saw choppy trading.

Worries about the euro zone debt crisis, however, dragged on stocks abroad after Italy's biggest bank, UniCredit, priced a 7.5 billion euro (6.2 billion pound) capital hike at a massive discount. That level, in turn, could discourage other lenders from tapping the market to raise money.

UniCredit slumped 14.5 percent on Wednesday, the biggest blue-chip loser in Europe.

In contrast, crude futures rallied on news that European governments have agreed in principle to ban imports of Iranian oil, dealing a blow to Tehran that crowns new Western sanctions months before an Iranian election.

The agreement sent oil to a seven-week high. Brent February crude hit $113.97 per barrel, its highest since November 14, before paring gains to trade up 1.35 percent at $ 113.64.

U.S. crude oil futures rose 0.3 percent to $103.26 per barrel.

CRUDE PRICES SEEN RESTRAINED

Analysts said crude price moves were relatively restrained because no details had emerged about when sanctions would be implemented. Some analysts said their potential to affect oil prices may be exaggerated.

India, China and some other Asian countries may end up getting a reduced price on Iranian oil and that could be good for their economies, but European countries will have to find other sources, said Gene McGillian, an analyst with Tradition Energy in Stamford, Connecticut.

The United States supports the ban and believes Tehran's oil revenues can be choked off without disrupting global oil markets, a U.S. Treasury official said.

The EU agreement came after Iran threatened Tuesday to take action if the U.S. Navy moves an aircraft carrier into the Gulf. Oil shot up after the Iranian warning.

The single currency fell 0.86 percent to $1.2938, within striking distance of its 2011 trough of $1.2858, hit in the last week of December.

The FTSEurofirst 300 index of top European shares closed down 0.63 percent in low volume, capping a four-session streak of gains.

Italy's FTSE MIB was the biggest declining major index, down 2 percent, hit also by worries about the country's own refinancing needs.

Adding to anxiety about the euro zone, data suggested the region's banks remained wary of lending to each other, with commercial lenders' overnight deposits at the European Central Bank hitting a new record high of 453 billion euros.

A subdued German bond auction underwhelmed the market. Bids for the Bunds amounted to 1.3 times the amount offered, an improvement over a previous November sale that was one of the country's least successful since the introduction of the euro.

The sale was much better than November's auction, but not particularly great either, said Peter Chatwell, rate strategist at Credit Agricole.

Italian yields hovered close to 7 percent, a level deemed by many analysts as unsustainable and near where other countries needed a bailout.

(Additional reporting by Ryan Vlastelica and Gene Ramos; Editing by Kenneth Barry and Jeffrey Benkoe)