Americans boosted their spending on cars and online purchases in August, supporting economic growth and pushing retail sales higher than economists had expected.

Retail sales rose a seasonally adjusted 0.4 percent in August from a month earlier, the Commerce Department said Friday. The figures include sales at department stores, restaurants, car dealerships, gas stations, and online shops.

Economists had forecast a more modest 0.2 percent gain. The previous month’s gain, boosted in part by Amazon’s Prime Day sales, was revised up to 0.8 percent from 0.7 percent.

Online sales, were expected to drop off steeply in a kind of post-Prime Day hangover, were surprisingly strong, rising 1.6 percent. Sales at home and garden centers were also robust.

Auto sales jumped 1.8 percent. These can be volatile month-to-month. But purchases of big-ticket items like cars are generally a sign of consumer confidence and typically fall early in a slumping economy

Sales fell, however, at department stores. Americans also spent less on food, dining out, and furniture. Maybe it was just too hot to spend much on food and dining.