Stocks finished flat on Wednesday as cautious comments from FedEx and weak housing market data overshadowed a surge in industrial production.

Investors were caught off guard after package company FedEx Corp , deemed an economic bellwether because it serves a wide range of industries, said higher costs would constrain 2011 earnings. FedEx shares slid 6 percent to $78.07.

The U.S. government said housing starts fell more than expected in May, underscoring the uneven nature of the economic recovery and casting a shadow over better-than-expected industrial production data for the same month.

The market's slow churn kept the S&P 500 above its 200-day moving average a day after the index exceeded that level for the first time in a month. Investors took that as a positive signal because they view the 200-day average as an important momentum indicator.

Essentially, the market has held on to yesterday's gains and you have to call that encouraging, said Michael Sheldon, chief market strategist at RDM Financial in Westport, Connecticut.

The Dow Jones industrial average <.DJI> added 4.69 points, or 0.05 percent, to 10,409.46. The Standard & Poor's 500 Index <.SPX> edged down just 0.62 of a point, or 0.06 percent, to 1,114.61. And the Nasdaq Composite Index <.IXIC> inched up just 0.05 of a point, or 0.00 percent, to 2,305.93.

Wednesday's session left the Dow and the S&P 500 just below the break-even point for the year, while the Nasdaq is

up 1.6 percent for 2010.

Stocks have fallen sharply since a recent closing high on April 23, mainly on fears of slower growth and unsustainable public debt in the euro zone. The S&P 500 is still down 8.4 percent since that date after falling nearly 14 percent to an intraday closing low on June 7.

BP, APPLE AND 3M CLIMB

On the closely watched energy front, BP Plc agreed to U.S. President Barack Obama's demand to place about $20 billion in a special fund to pay damage claims from the Gulf of Mexico oil spill.

The British company also said it would not pay dividends to its shareholders this year. BP also said it plans to reduce its investment program and sell $10 billion of assets for a planned fund to cover the costs related to its Gulf of Mexico oil spill.

BP's New York-traded shares rose 1.5 percent to close at$31.85, after earlier climbing as much as 5.1 percent to an intraday high at $33.

The market expected it, and everyone was prepared for this, which is the only reason the stock is reacting the way it is, said Chip Hanlon, president of Delta Global Advisors in Huntington Beach, California.

Shares of some U.S. drillers and other energy companies also advanced, with Halliburton Co up 3.1 percent at $26.25.

Strong sales from Apple Inc, which said it sold 600,000 of its iPhone 4 smartphones in a single day of pre-orders, helped cushion the Nasdaq. Apple's stock was up 2.9 percent at $267.25.

Before the opening bell, the Federal Reserve Board reported that industrial output surged 1.2 percent in May, partly due to a spike in utility production, and a solid gain of 0.9 percent in factory output.

Shares of 3M Co , a diversified manufacturer, rose 1.4 percent to $80.88 and ranked as the Dow's biggest positive influence.

The industrial production number is saying that demand is still there, production is still there, said Marc Pado, U.S. market strategist at Cantor Fitzgerald & Co. in San Francisco. That's telling me there is going to be a nice little increase in profit margins, even on flat revenue.

WORRIES ON THE HOME FRONT

But reflecting the housing sector's struggles, the U.S. government said housing starts fell more than expected in May, hitting a five-month low, after a federal homebuyer tax credit expired.

The Morgan Stanley housing index <.HGX> fell 1.6 percent. The index tracks the shares of U.S. companies in the housing sector, including home builders like PulteGroup Inc as well as lumber companies like Weyerhaeuser Co .

Pulte shares slid 1.8 percent to $9.75, while Weyerhaeuser lost 2 percent to $39.95.

About 8.40 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, well below last year's estimated daily average of 9.65 billion.

Declining stocks outnumbered advancing ones on both the NYSE and the Nasdaq by a ratio of about 3 to 2.

(Reporting by Edward Krudy; Editing by Jan Paschal)