Stocks held gains led by technology and retailers after a stronger-than-expected rise in business inventories and a gain in retail sales that was slightly better than expected.
The Dow Jones Industrial Averagerose more than 20 points after falling more than 40 points earlier. Hewlett-Packard , Cisco and Wal-Mart led the blue-chip index higher. Dow components American Express and Bank of America fell.
The S&P 500and the Nasdaqalso rose. The CBOE Volatility Index, the mostly widely used gauge of fear in the market, rose above 21.
Technology, telecom and consumer discretionary sectors gained, while financials declined.
Business inventoriesposted the largest increase in two years, rising 1 percent in July, the Commerce Department reported. Economists had expected an increase of 0.8 percent.
And the government said total retail sales gained 0.4 percent in August, slightly ahead of expectations of a 0.3 percent rise. Core sales, which exclude food and transportation, rose 0.6 percent, also better than expectations.
"I think what you're seeing here is once again reaffiriming that the consumer is not dead," Daniel Genter, CEO and CIO of RNC Genter Capital Management, said on CNBC. "They are in there and they are spending, and it’s going to be optimistic."
Retailers were all higher after the retail sales data revealed the highest gains in five months. JC Penney soared more than 7 percent, and led the S&P 500. Abercrombie & Fitch , Kohl's and Macy's also jumped.
On the earnings front, Best Buy delivered more positive retail sales news, sending its stock soaring as well. The electronics retailer reported a 60 percent boost in net income for the fiscal second quarter, better than forecasted, while revenue rose 3 percent to $11.34 billion, from $11.02 billion last year.
And Kroger posted strong quarterly earnings and confirmed its fiscal year outlook for $1.60 to $1.80 a share on sales growth of 2 percent to 3 percent, excluding gasoline sales. The supermarket chain's shares jumped.
Kroger's strong same-store sales growth of 2.7 percent signals the "very beginning of an industry turnaround," Andrew Wolf, a food merchandising analyst at BB&T Capital Markets said on CNBC. In another good sign for the industry, Kroger's results also showed the supermarket chain is gaining pricing power, Wolf said.
Elsewhere, American International Group shares slumped after news the companyis planning to convert the government's preferred shares to common stock in an effort to wean itself more quickly from the U.S. government, the Wall Street Journal reported.
Boeing is under pressure after the U.S. Air Force said defense budgets are unlikley to rise, and may decline.
Most steel stocks fell after Nucor said its earnings in the third quarter will be lower than expected because of slowing demand and bigger-than-expected inventory charges. Arcelor Mittal , US Steel , and Friedman Industries all fell.
In merger and acquisitions news, Green Mountain Coffee Roasterswill buy Van Houtee, a Canadian rival, to gain access to the Canadian market. Green Mountain, which will pay $890 million, also recently bought Diedrich Coffee. The coffee company's shares are slightly lower.
In other markets, investors continued to flock to the safety of gold as the precious metal hit record highs above $1,270 an ounce. The rally was the biggest one-day gain in four months.
The yuan hit a new post-revaluation high against the dollar, as the Chinese authorities are seen yielding to U.S. pressure to let the currency appreciate.
Elsewhere in economic news, the National Federation of Independent Businesses said its small business index showed a slight increasein optimism in August, but the figure remains consistent with expectations of a recession.
Meanwhile, there are mixed messages about investor confidence. A survey conducted by CNBC and AP found that many individual investors see the stock market as unfair to them and they have little confidence in regulators to fix it. But Morgan Stanley CEO and President James Gorman said on CNBC that confidence among investors is slowly returning.
On the Calendar:
TUESDAY: API weekly report
WEDNESDAY: MBA mortgage applications, Empire State manufacturing survey, import and export prices, industrial production, weekly oil inventories
THURSDAY: PPI, current account, jobless claims, Phili Fed survey; before-the-bell earnings from FedEx, after-the-bell earnings from Oracle and Research In Motion
FRIDAY: CPI, consumer sentiment
More From CNBC.com: