Oil extended the longest rally in two years as tensions with Iran threatened supplies while signs of economic growth boosted the outlook for demand. The Standard & Poor's 500 Index closed at the highest level since June 2008.
Crude for April delivery rose for a seventh day, increasing 1.8% to $109.77 a barrel, the highest settlement since May 3. The Standard & Poor's 500 Index increased 0.2% to 1,365.74 after earlier rallying as much as 0.4%.
The Dow Jones Industrial Average slipped 1.74 points to 12,982.95, retreating from an almost four-year high. The Dollar Index, a gauge of the currency against six major peers, lost 0.6%.
Financial firms and companies that rely on discretionary consumer spending were the biggest drag on the S&P 500 as the index trimmed an early advance triggered after sales of new homes exceeded economists' forecasts and a gauge of consumer confidence topped estimates.
"Energy prices are getting to the level where you would expect to start to see consumer spending slow," Barry Knapp, head of equity strategy at Barclays Capital Inc. in New York, told Bloomberg Television. "And we're seeing that in the stock market in a sense."
The S&P GSCI gauge of 24 commodities advanced 1.1% to the highest since May, led by gains in oil and industrial metals.
Oil surged 6.3% this week and may rise again next week on concern that shipments will be disrupted as Western sanctions against Iran tighten, a Bloomberg News survey showed.