NEW YORK (AP) — Stocks are shaking off a two-week slump after retailers had better sales in May than analysts had predicted. The Dow Jones industrial average climbed back above 12,000, and all three major indexes are on track to have their best day so far in June.

The government reported Tuesday that retail sales edged down 0.2 percent last month, the first decline in nearly a year. That was slightly better than economists had forecast. Americans bought fewer cars during the month, but the decline reflected temporary supply chain disruptions caused by the earthquake and tsunami disaster in Japan. Excluding weak car sales, retail sales rose 0.3 percent.

"The good news is the consumer is hanging in there," said Rob Lutts, president and chief investment officer of Cabot Money Management.

The stronger report on retail sales sent the stocks of department stores and other retailers higher. Nordstrom Inc. and Home Depot Inc. rose 4 percent. J.C. Penney Co. jumped 19 percent after the department store chain named Ron Johnson, the man who pioneered Apple Inc.'s retail stores, as its next CEO. J.C. Penny's stock rose the most of any company in the S&P 500.

The government also reported that wholesale prices rose in May by the smallest amount in 10 months. That helped to allay concerns among investors that rising food and energy costs would slow the economic recovery.

The Dow Jones industrial average rose 148 points, or 1.2 percent, to 12,100 in afternoon trading.

The Standard & Poor's 500 index rose 18, or 1.4 percent, to 1,289. The Nasdaq composite index rose 42, or 1.6 percent, to 2,681.

Stocks have tanked over the past two weeks on concerns that the economy is losing strength. Themanufacturing industry is slowing, home sales are weak and the job market remains sluggish. Investors are also nervous because the Federal Reserve's $600 billion bond-buying program is winding down at the end of June. The program was aimed at keeping interest rates low to encourage borrowing.

The Dow and S&P 500 have lost 4 percent so far this month. The Nasdaq composite has lost 5 percent.

In corporate news, Best Buy Co. Inc. rose 5 percent after the company reported first-quarter results that beat analysts' forecasts. The company reaffirmed its full-year earnings forecast and said revenue would come in at the high end of the $51 billion to $52.5 billion range it has been expecting.

Energy stocks rose 2 percent, the most of the 10 company groups that make up the S&P 500, after oil rose above $98 a barrel. Energy stocks have fallen 9 percent since the S&P 500 peaked in late April, making them appear relatively cheap compared to other industries that haven't fallen as much.

Exxon Mobil Corp. rose 2 percent. Coal producer Peabody Energy Corp. rose 4 percent.