Light, sweet crude rose $2.77 to settle at $40.18 per barrel on the New York Mercantile Exchange.
News on the economic front was mixed, providing little guidance for a restless market.
An index of leading economic indicators logged a surprise increase in January, the second straight monthly gain, but the Philadelphia Federal Reserve said conditions in the region's manufacturing sector weakened in February. Also, a reading on wholesale prices, the Producer Price Index, jumped more than expected in January, the first increase in six months.
Technology and financial stocks weighed on the market. H-P fell $2.69, or 7.9%, to $31.39 after its fourth-quarter sales fell short of Wall Street's expectations and it reduced its forecast.
Citigroup fell 40 cents, or 13.8%, to $2.51, while Bank of America fell 64 cents, or 14%, to $3.93.
Some investors turned to consumer staples stocks after drugstore operator CVC Caremark. posted a better-than-expected 17% increase in earnings for the final three months of 2008. CVS rose $1.72, or 6.4%, to $28.71.
Sprint rose 54 cents, or 19.9%, to $3.25, while Whole Foods rose $3.46, or 37.2%, to $12.75.
Overseas, Britain's FTSE 100 rose 0.3%, Germany's DAX index rose 0.2%, and France's CAC-40 fell 0.1%. Japan's Nikkei stock average rose 0.3%.