NEW YORK - Investors recovered their poise after a shaky start to trading on Wall Street that sent stocks sharply lower.

U.S. markets plummeted immediately after the opening bell Thursday after a global slump prompted in part by an unexpectedly weak report on manufacturing in China. Concern that the Federal Reserve might ease back on its economic-stimulus program sooner than expected had also riled investors.

The dip gave investors who had missed this year's rally in stocks an opportunity to get into the market, and by midday stocks had recouped most of their early losses. The market even climbed into positive territory by midday, before ending the day marginally lower.

The Dow Jones industrial average ended the day just 12.67 points lower, or 0.1 percent, at 15,294.50, after falling as much as 127 points during the first hour of trading.

The Standard & Poor's 500 index closed down 4.84 points to 1,650.51, or 0.3 percent. The Nasdaq composite fell 3.88 points, or 0.1 percent, to 3,459.42.

Investors were unsettled by a report Thursday that showed manufacturing in China, the world's No. 2 economy, unexpectedly shrank this month. HSBC Corp. said the preliminary version of its monthly purchasing managers index had dropped to a seven-month low.

China's booming economy has been a major driver of global growth in recent years, and investors worry when they see signs that it is slowing.

Stocks fell sharply in Asia on Thursday. Japan's Nikkei index dropped 7.3 percent after news was released about the slowdown in Chinese manufacturing. The declines extended to Europe, where Germany's DAX index, which has been at a record high, slid 2.1 percent.

In commodities trading, the price of crude oil fell 0.55 cents, or 0.6 percent, to $96.16 a barrel. Gold rose $24.40, or 1.8 percent, to $1,391.80 an ounce.

Among stocks making big moves, Ralph Lauren fell $4.37, or 2.3 percent, to $183.69. The apparel seller reported revenue that fell short of what financial analysts were expecting. Sluggish economic conditions and the decision to cut certain businesses reduced sales.

The PC maker Hewlett-Packard surged $3.63, or 17.1 percent, to $24.86, after the company delivered second-quarter earnings that topped the estimates of both its own management and financial analysts.

Dollar Tree rose $1.82, or 3.8 percent, to $50.19 after the discount retailer said that its earnings climbed 15 percent as customers spent more at its stores. The earnings beat the expectations of Wall Street analysts.