U.S. stocks closed nearly flat on Wednesday on positive economic data as crude settled higher on a European Union preliminary agreement to ban imports of Iranian oil.

But the euro and European stocks struggled as investors fretted about the region's debt crisis as more countries prepare to tap markets.

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

While volumes were low, some investors were encouraged to see equities avoid a sell-off amid lingering euro zone debt problems.

The market is still teetering between European concerns and better economic data here in the United States, 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 ended the day 0.17 percent higher for a second straight advance. The Nasdaq Composite Index closed off 0.01 percent and the Standard & Poor's 500 Index up 0.02 percent.

Worries about the euro zone debt crisis, however, dragged on stocks abroad after Italy's biggest bank, UniCredit, priced a 7.5 billion euro 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.

Crude oil futures rallied after European governments 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 settle 1.4 percent higher at $113.70.


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.84 percent to $1.2941, 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.

France will add to the brisk start to the 2012 debt auction calendar by selling up to 8 billion euros of bonds on Thursday. But the key test of investor sentiment comes next week when Spain and Italy, the two countries most exposed to an escalation of the crisis, kick off their funding campaigns.

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 Padraic Cassidy)