The national price for regular unleaded gasoline jumped 2.2 cents a gallon over the last week to $1.917, the first rise since May 24, according to the U.S. Energy Information Administration's weekly survey of service stations.
The Energy Department's analytical arm said pump prices are 40 cents a gallon higher than a year ago.
The rise at the pump mirrored the increase in crude oil prices, which have shot up about $3 a barrel in the last two weeks.
Oil accounts for almost half the cost of producing gasoline, and the higher prices finally reached consumers at the pump.
Oil for delivery in August hit $40.75 a barrel on Monday at the New York Mercantile Exchange, the highest since June 3, until traders took some of their profits and the price settled down 46 cents to $39.50 a barrel.
The EIA's weekly report also showed the retail price for cleaner-burning reformulated gasoline, sold in polluted metropolitan areas, declined 0.3 cent to $2.017 a gallon.
The West Coast had the most expensive regular unleaded gasoline, with the price down 1.2 cents to $2.124 a gallon. San Francisco topped the agency's city survey of gasoline costs, but the price fell 2 cents to $2.22 a gallon.
The U.S. Gulf Coast had the cheapest fuel by region, with the price up 2.1 cents at $1.805 per gallon. Houston had the lowest pump price at $1.748 a gallon, up 0.9 cent.
The weekly report also showed gasoline prices were down 1.3 cents to $2.037 in New York City, down 5.2 cents to $1.992 in Seattle, down 0.2 cent to $1.981 in Miami, up 2.7 cents to $1.945 in Chicago, and up 4.6 cents to $1.862 in Cleveland.
Separately, the EIA survey said the average pump price for diesel fuel increased 2.4 cents to $1.74 a gallon, up 31 cents from a year earlier.
Truckers on the West Coast paid the most for diesel fuel at $2.04 a gallon, up 3 cents from the prior week. The lower Atlantic states had the cheapest diesel at $1.67, up 2.1 cents.