Stocks lost ground in the final minutes of trading but still showed resilience after Tuesday's sharp sell-off to end with modest gains, even as oil prices climbed above $100 a barrel.
TheDow Jones Industrial Average rose 8.78 points, or 0.07 percent, to close at 12,066.80, a day after a selloff of more than 1 percentas oil prices soared.
Caterpillar and 3M led gainers on the blue-chip index, while JPMorgan and Boeing fell.
The S&P 500 rose 2.11 points, or 0.16 percent, to close at 1,308.44, while the tech-heavy Nasdaq also gained 10.66 points, or 0.4 percent, to close at 2,748.07. The CBOE Volatility Index, widely considered the best gauge of fear in the market, fell below 21.
Among key S&P 500 sectors, energy, tech and industrials rose, while financials fell.
The Federal Reserve's "beige book" of regional economic activity showed the economy expanded at a modest pace and that manufacturers and retailers have been able to push some price increases through.
The market initially fluctuated after the news before settling higher. Of bigger concern to market participants at the moment are oil prices and the potential for Middle East unrest to spread, particularly to Saudia Arabia. The Saudi market tumbled to a 22-month lowamid calls for nationwide protests later this month.
"If we continue to see that sell off, that tells us what investors on the ground are terrified of," said Quincy Krosby, market strategist at Prudential Financial.
The market also may be effectively treading water on Wednesday as investors await Friday's release of government jobs data, Krosby said.
"This number should highlight the underpinnings we’ve seen in many of the surveys suggesting private sector job creation is gaining momentum," she said.
Earlier, a private industry report from ADP Employer Services and Macroeconomic Advisers showed U.S. private employers added 217,000 jobs in February. Economists expect the Labor Department will report a 185,000 gain in nonfarm payrolls, and a 190,000 gain in private-sector jobs when the data is released Friday, according to Reuters.
Oil markets continued to be rattled by news in the Middle East, as forces loyal to Muammar Gaddafi intensified fighting, and a Libyan warplane reportedly dropped a bomb near an oil exporting terminal. U.S. light sweet crude closed above $102 a barrel, its highest close since Sept. 26, 2008, while London Brentcrude closed above $116.
Gold soared to close at $1437.20 an ounce, hitting a new record. The dollar fell against a basket of currencies, and the euro rose to a four-month high against the U.S. currency.
Semiconductors led the market higher after JPMorgan upgraded the sector to "constructive" from "cautious." The brokerage cited Texas Instruments as its top pick, raising its rating on the stock to "overweight" from "neutral." JPMorgan also raised Xilinx and ON Semiconductor to "overweight" from "neutral."