Shoppers got back in the buying mood in July, propelling sales at the nation's retailers up by 1.4 percent, the most in six months.

The snapback reported Friday by the Commerce Department came after shoppers hunkered down in June, depressing retail sales by 0.4 percent, according to revised figures. June's sales turned out to be even weaker than the 0.1 percent dip reported a month ago.

Click here to visit FOXBusiness.com's Economy Center.

The showing on retail sales for July was stronger than economists were expecting. They had forecast a 0.8 percent gain.

"Consumers appear to be hanging tough and are doing their part to ensure that the economic expansion remains intact," said Mark Zandi, chief economist at Moody's Economy.com.

In a separate report from the department, stockpiles of unsold goods grew by 0.8 percent in June as businesses' sales inched up just 0.2 percent. June was not only a weak month for retailers' sales, but also for manufacturers' sales, the report said. The increase in inventories in June was larger than the 0.5 percent rise economists were anticipating.

With shoppers regaining their appetite to spend, they snapped up a variety of goods. Sales rose at stores selling electronics and appliances, building and garden supplies, health and beauty goods, and furniture. Sales also went up at bars and restaurants. Auto dealerships, where sales have flagged in recent months, also saw an improvement as incentives and promotions helped lure buyers.

There were weak spots, however. Sales at sporting goods, hobby, book, music and department stores slipped.

Economists closely watch consumer behavior because their spending accounts for roughly two-thirds of all economic activity.

The 1.4 percent increase for overall retail sales in July was the most since January, when sales jumped by 3 percent.

Excluding sales of automobiles, which can swing widely from month to month, sales at all other merchants rose by a strong 1 percent — after edging up 0.1 percent in June.

Last month's increase in this category excluding autos also was the most since January and exceeded economists' expectations for a 0.5 percent gain.

Sales at gasoline stations also rose strongly in July, reflecting the high prices at the pump. However, even when these sales are taken out of the total, all other merchants' sales rose by 1.3 percent — the biggest increase since January.

Shoppers were out spending in July despite high energy prices, which have strained some families' budgets.

The retailing rebound also comes as consumer confidence has dipped.

The RBC CASH Index, based on results from the international polling firm Ipsos, showed confidence ebbed to 74.8 in early August. That marked a sharp drop from July's showing of 80.1. It was the second month in a row that confidence dropped.

Economists blamed the deterioration mostly on galloping energy prices and a cooling in the once-hot housing market.

Oil prices, which hit a record closing high of $77.03 a barrel in mid-July, have eased a bit since then but still remain lofty. Gasoline prices are above $3 a gallon in many areas.

Federal Reserve Chairman Ben Bernanke and his colleagues on Tuesday opted not to boost interest rates for the first time in more than two years. The halt in the Fed's credit-tightening campaign gives policy-makers time to assess how much its previous rate increases are crimping the economy.

The economy slowed sharply in the spring as consumers tightened their belts. Friday's report suggests consumers still have energy and aren't in danger of snapping their pocketbooks shut.

The Fed's goal is to slow the economy sufficiently to thwart inflation, but not weaken activity too much.

Click here to visit FOXBusiness.com's Economy Center.