Companies were confident enough in the economy in August to keep stocking their shelves, even as other data stoked recession fears.

Businesses added to their stockpiles for a 20th consecutive month and their sales rose for a third straight month, the Commerce Department said Friday. Inventories increased 0.5 percent in August, matching the July gain. Sales climbed 0.3 percent, following a 0.7 percent July increase.

A separate report Friday showed consumers stepped up their spending on retail goods in September. The 1.1 percent gain was the largest in seven months, a hopeful sign for the sluggish economy.

Businesses appeared to believe they'd see enough future demand. So they shrugged off plunging financial markets, weak growth in the first half of the year and the lowest consumer confidence in two years to continue building their stockpiles.

The inventory report covers stockpiles at the manufacturing, wholesale and retail levels. All three levels showed increases in August. Retail inventories rose 0.8 percent to lead all three. Inventories at the manufacturing and wholesale levels both increased 0.4 percent.

Sales at the wholesale level rose 1 percent. Retail sales ticked up 0.3 percent while manufacturers' sales dropped 0.2 percent.

The August gain in stockpiles pushed total business inventories to $1.54 trillion, 16.6 percent higher than their low hit in September 2009. During the recession, businesses had cut back on their inventories in the face of plunging demand. The restocking that has occurred over the past two years has been a major support for the economy as factories have increased production to meet rising orders.

However, the overall economy slowed significantly in the first half of this year as a big spike in gasoline prices caused consumers to cut back on their spending on other products. Overall growth slowed to just 0.9 percent from January through June, the weakest performance since the recession officially ended in June 2009.

Economists expect growth will show a slight improvement to around 2 percent in the second half of the year.