U.S. stocks ended with modest gains on Wednesday after ADP National Employment report showed that the private sector employment rose more than expected in February, but shares came off their highs due to fears over the continued unrest in Libya and rising crude oil prices.

The Dow Jones Industrial average gained 8.78 points, or 0.07 percent, to 12,066.80. The S&P 500 Index rose 2.11 points, or 0.16 percent, to 1,308.44. The Nasdaq Composite Index added 10.66 points, or 0.39 percent, to 2,748.07.

Employment in the US private sector rose more than expected in February, posting a gain for a fifth straight month. On seasonally adjusted basis, private-sector employment rose 217,000 in February, from upwardly revised gain of 189,000 in January, while economists estimated an increase by 175,000.

A significant part of employment growth in February came from the services sector, where jobs rose by 202,000, recording an increase for thirteen months in a row. Manufacturing sector posted a gain of 20,000 jobs, while the construction employment dropped by 9,000. However, jobs growth in financial services remained flat in the month.

The Federal Reserve's Beige Book revealed that manufacturers and retailers across all twelve of its districts are passing on rising commodity prices to consumers, but that the economy continues to grow moderately.

Fears of a supply disruption arising from continued unrest in Libya have pushed up oil prices above $102/barrel, the highest since September 2008, but a leading Libyan oil official warns they could spike even higher if there is no immediate resolution to the ongoing violence.

On the corporate front, MetLife, Inc. (NYSE:MET) shares declined 5.71 percent to 43.41. The company announced plans to offer 68.57 million shares to the public.

Shares of Texas Instruments Inc. (NYSE:TXN) advanced 3.26 percent after the company stock was upgraded to “overweight” rating from “neutral” rating at JPMorgan.

Yahoo (Nasdaq: YHOO) jumped 3.29 percent on reports that the online portal company is in negotiations to sell its 30 percent stake in its Yahoo Japan venture.