Gasoline prices have surged to a record nationwide average of $3.07 per gallon, nearly 20 cents higher than two weeks earlier, according to oil industry analyst Trilby Lundberg.

The previous record was $3.03 per gallon on Aug. 11, 2006.

But despite inventory fears that have sent prices higher, there are signs that the rising prices at the pump may be peaking.

Just two weeks ago, the U.S. average for a gallon of regular gas was $2.87, but the Lundberg Survey of 7,000 stations nationwide on Friday showed an increase of about 19.5 cents to $3.07. That's up 88.4 cents since Jan. 19, Lundberg said.

The nationwide average for mid-grade gasoline was $3.18 and premium was $3.28.

The nation's lowest average pump price was $2.80 per gallon in Charleston, S.C., while the highest was $3.49 in San Francisco.

The recent increases are due mostly to refinery problems, Lundberg said, noting there have been at least a dozen additional partial shutdowns in the U.S. and internationally that cut refining capacity.

One of the nation's largest refineries, a BP PLC plant in Indiana that processes more than 400,000 barrels of oil per day, will not be operating at full capacity for several months due to unexpected repairs.

Other examples include a 170,000-barrel-per-day plant in McKee, Texas, that was shut down for a month, and a 470,000 barrels-per-day plant in Texas City operating at less than half capacity.

The outages have been reflected in weekly government data which has shown gasoline inventories falling during a season when most analysts think they should be rising. Summer driving begins Memorial Day weekend, and analysts worry refineries won't be producing enough gasoline by then to meet demand.

The Oil Price Information Service and AAA reported Friday that the national average price of a gallon of gasoline hit $3.012 that day, up 2.1 cents overnight.

Despite prices at the pump climbing past the $3 mark, analysts have said the inventory fears can only go so far, as evidenced by recent declines in oil and gas futures. Retail prices generally lag the futures markets, so consumers can end up paying more for gas even as futures prices drop.

Gasoline futures for June delivery have dropped in the last week, falling 3.12 cents Friday to settle at $2.2164 a gallon on the New York Mercantile Exchange.