The prospect of summer drivers crowding U.S. highways is powering steep gains in the price of gasoline, a sign of economic recovery and a boon for the pandemic-ravaged energy industry. Lifted by oil’s recovery and growing consumer demand, gasoline prices at pumps in the U.S. hit an average of $2.88 a gallon over the past week, according to the AAA. That is up about one-third over this time last year, when the pandemic’s lockdowns slammed fuel usage.

Rising prices are an early season gift for fuel makers including Valero Energy Corp. VLO 2.43% and Phillips 66 PSX 3.86% after a bruising year, helping to make energy shares the top-performing sector this year in the S&P 500. A proxy for profit margins at refiners, calculated from the gap between gasoline and crude-oil futures, recently neared its highest level in three years at more than $24 a barrel.

Drivers are already paying a lot more than $3 a gallon in some states. In California, the most expensive market, average prices stand at $3.88, according to AAA. Motorists in Mississippi, Texas and Ohio, on the other hand, are paying closer to $2.60. Gas prices vary widely due to factors including tax policies and proximity to pipelines. Some analysts see further gains ahead. Prices tend to climb closer to summer, when millions of Americans drive to vacation spots and petroleum refiners blend costlier fuel that won’t evaporate in the heat.

Booming gas prices join a recent rally in other commodities such as copper, as well as improving data on jobs and spending, as signals that the economy is gathering momentum. At the same time, elevated fuel prices are biting some consumers and businesses.

In Colorado, where gas prices have climbed by nearly 40 cents a gallon over the past month, landscaper and tree surgeon Allan Trujillo is feeling the pinch. Mr. Trujillo drives a 1996 Ford Econoline to work from his home in Arvada and runs fuel-consuming machinery including chain saws and power trimmers. He said he is spending about $100 a week on gas right now, up from around $60 normally at this time of year.

“This just seems a little bit too early in the year” for gasoline prices to rise said Mr. Trujillo, 45 years old. “When we do want to drive out to the locations that are further out it’s definitely going to cost us a little bit more.”