WASHINGTON—Despite rising gas prices, Americans ramped up their spending at the start of spring, signaling modest wage gains and the recent tax overhaul helped buoy spending.

Retail sales—a measure of spending at stores, online-shopping websites and restaurants—rose a seasonally adjusted 0.3% in April from the prior month, the Commerce Department said Tuesday. That growth was largely broad-based, and held up even when excluding gasoline and autos. Food and beverage stores, and clothing and accessories retailers both clocked the largest sales gains since last year. A weak spot was spending at restaurants and bars, declining 0.3% from March.

Analysts had worried that rising gas prices would slow consumer spending in the near term. The national average price for a gallon of regular gasoline in April was $2.76, up nearly 17 cents from the prior month and the highest since mid-2015, according to the U.S. Energy Information Administration. Gasoline-station sales rose 0.8% in April from the prior month.

But when excluding gasoline and autos, spending still rose 0.3% from March, suggesting modest wage gains and larger paychecks from the Trump administration’s late-2017 tax reform helped push consumers to make more purchases.

“It seems that even with the move in energy prices, consumers had the will to spend on nonenergy items,” said Michael Feroli, chief U.S. economist at JPMorgan Chase.