US stocks staged a late-afternoon comeback on Tuesday, closing higher as investors focused on strong economic data, putting aside worries over a spike in crude oil prices to a record high.
ExxonMobil Corp and other oil producers gained from the higher prices following the weekend attack on oil interests in Saudi Arabia.
Pharmaceutical companies also jumped, with Merck & Co Inc leading the blue chip Dow higher and Baxter International Inc providing a boost to the Standard & Poor's 500 index.
The Dow Jones industrial average closed up 14.2 points, or 0.14 percent, at 10,202.65. The Standard & Poor's 500 Index gained 0.56 point, or 0.05 percent, to 1,121.24.
The technology-focused Nasdaq Composite Index rose 4.03 points, or 0.2 percent, to 1,990.77.
The indexes spent most of the day lower as investors worried that soaring oil prices would raise costs for companies and consumers. Strong factory and construction data early in the day briefly lifted stocks before rising oil prices sent them lower.
But optimism came back late in the day, said Peter Cardillo, chief market analyst at SW Bach and Co. An Institute for Supply Management survey showed US manufacturing grew faster than expected in May, while Commerce Department data showed the monthly increase in construction spending beat Wall Street's estimates.
Trading was light after a three-day weekend, with US markets closed on Monday for the Memorial Day holiday. Many traders were not yet back from vacation.
Some investors also were waiting on the sidelines until Friday's payroll report for May from the Labor Department, which will show the number of new jobs added by the economy for that month.
About 1.24 billion shares changed hands on the New York Stock Exchange, below the 1.4 billion daily average for last year. About 1.44 billion shares were traded on Nasdaq, less than the 1.69 billion daily average last year.
Advancers outnumbered decliners on the NYSE by 17 to 16, and 17 to 14 on Nasdaq.
ExxonMobil shares rose 45 cents, or about 1 percent, to $43.70.
NYMEX crude oil futures settled up $2.45, or 6 percent, at $42.33 a barrel, setting a 21-year record.
The surge came even as Saudi leaders rushed to reassure the world about security concerns after suspected al Qaeda militants killed 22 people linked to the Saudi oil industry.
Merck shares rose $1.06, or 2.2 percent, to $48.36, making it the biggest percentage gainer on the Dow.
Baxter added 28 cents to $31.72.
Viacom Inc shares dipped as the media giant said No 2 executive Mel Karmazin will step down, ending years of tension with Chief Executive Sumner Redstone.
Viacom shares were among the most heavily traded on the New York Stock Exchange, falling 39 cents, or 1.1 percent, to $36.50. Viacom said Karmazin, who has been president and chief operating officer since 2000, will be replaced by two of Viacom's most powerful unit heads, MTV Networks CEO Tom Freston and CBS CEO Leslie Moonves.