WASHINGTON — U.S. retail sales rose at a solid pace last month, providing crucial support to the economy at a time when other drivers of growth have faded.

The Commerce Department said Tuesday that retail sales rose 0.4% in June, the fourth straight increase. Sales at online retailers, grocery stores, home and garden stores, and at restaurants and bars all increased at a healthy pace.

Excluding volatile gasoline sales, retail sales were even stronger, rising 0.7%. Gas station sales dropped 2.8% in June, because of lower prices.

A category that is mostly made up of online retail sales jumped 1.7% for the second month in a row.

Retail sales account for about one-third of Americans’ spending, while the other two-thirds are in services.