Stocks Log Gains on Economic Data; H-P Skids

Stocks posted modest gains in volatile trading Wednesday, lifted by a batch of better-than-expected economic reports, but ongoing worries over a global slowdown kept investors on edge.

Symbol
Price
 
Change
%Change
NASDAQ
---
S&P 500
---

The Dow Jones Industrial Average eked out a gain of 12.25 points, or 0.09 percent, to end at 13,494.61, led by Home Depot .

But Hewlett-Packard plunged below $15 a share after the tech giant cut its 2013 earnings guidance, adding to the company's sharp share-price decline of almost 40 percent year to date. CEO Meg Whtiman added that the company's turnaround will take longer than initially expected. Rival Dell also slumped.

The S&P 500 rose 5.24 points, or 0.36 percent, to close at 1,450.99. The Nasdaq gained 15.19 points, or 0.49 percent, to finish at 3,135.23.

The CBOE Volatility Index, widely considered the best gauge of fear in the market, ended near 15. (Read More: Levels to Watch on S&P 500)

Among the key S&P sectors, telecomsended higher, while energy dragged.

The service sector expanded much more than expectedin September, rising to 55.1, according to the Institute for Supply Management’s non-manufacturing index. A reading above 50 indicates expansion in the sector. And private sector employment rose more than expected, according to payrolls processing firm ADP.

"As pleasant as it is to see an increase in private sector jobs, traders know the data rarely matches the forthcoming jobs report on Friday," said Todd Schoenberger, managing principal at The BlackBay Group. "Regardless, traders will be more forgiving of a disappointing number on Friday due to the recent actions by Ben Bernanke and the Fed."

Investors will be looking ahead to the all-important September government jobs data due at the end of the week, which includes both public and private sector employment. Economists expect the nonfarm payroll number to be up 113,000 jobs, while private payrolls are seen rising by 130,000.

Oil prices fell sharply to close at a two-month low following disappointing economic data from China and Europe and as U.S. domestic oil output hit the highest level in nearly 16 years last week, according to the Energy Information Administration.

Earlier, China's services sector report showed growth slowingin September. Meanwhile, the euro zone composite PMI data showed a contraction in the same period. European shares closed mixed.

Meanwhile, Kraft Foods Group , a spin off of Kraft Foods, saw an unusual spiketo $58.54 at the market open, before quickly falling back to regular levels. Nasdaq said it is canceling some trades above $47.82 and investigating the potentially erroneous transaction.

Homebuilders including Lennar , Pulte and DRHorton soared after a report that showed home prices are coming off the bottom faster than expected. Home prices climbed 4.6 percent in August from a year ago, the largest year-over-year gain in six years, according to market researcher CoreLogic.

Netflix surged to lead the S&P 500 gainers after Citi reiterated its "buy" rating on the online movie streaming company despite some risk surrounding the company's growth prospects.

US Airways rallied after the airline company posted better-than-expected traffic in September and reported growth in its domestic and Latin segments. United Continental and Delta Airlines also traded higher.

Best Buy jumped after Reuters reported the consumer-electronics retailer's founder Richard Schulze and at least four other private-equity firms are examining the company's books, which could lead to a $11 billion buyout.

Among earnings, Family Dollar rallied after the discount chain posted a higher quarterly profit. Meanwhile, Monsanto slid after the agribusiness company posted a loss. Hotel chain Marriott is scheduled to post earnings after the closing bell.

LifeLock tumbled on its first day as a public company after the identity fraud protection company priced its IPO at $9 a share, below the low end of its initial estimate.

By CNBC’s JeeYeon Park (Follow JeeYeon on Twitter: @JeeYeonParkCNBC)

Coming Up This Week:

THURSDAY: Chain-store sales, Challenger job-cut report, jobless claims, factory orders, FOMC minutes
FRIDAY: Non-farm payrolls, consumer credit

More From CNBC.com: