NEW YORK — There's plenty of gasoline in the Northeast — just not at gas stations.

In parts of New York and New Jersey, drivers lined up Thursday for hours at gas stations that were struggling to stay supplied. The power outages and flooding caused by Superstorm Sandy have forced many gas stations to close and disrupted the flow of fuel from refineries to those stations that are open.

At the same time, millions of gallons of gasoline are sitting at the ready in storage tanks, pipelines and tankers that can't unload their cargoes.

"It's like a stopped up drain," said Tom Kloza, Chief Oil Analyst at the Oil Price Information Service.

Superstorm Sandy mangled ports that accept fuel tankers and flooded underground equipment that sends fuel through pipelines. Without power, fuel terminals can't pump gasoline onto tanker trucks, and gas stations can't pump fuel into customers' cars.

The Energy Department reported Thursday that 13 of the region's 33 fuel terminals were closed. Sections of two major pipelines that serve the area — the Colonial Pipeline and the Buckeye Pipeline — were also closed.

Thousands of gas stations in New Jersey and Long Island were closed because of a lack of power. AAA estimates that 60 percent of the stations in New Jersey are shut along with up to 70 percent of the stations in Long Island.

On Thursday morning, the traffic to a Hess station on 9th Avenue in New York City filled two lanes of the avenue for two city blocks. Four police officers were directing the slow parade of cars into the station.

A few blocks away, a Mobil station sat empty behind orange barricades, with a sign explaining it was out of gas.

Taxi and car service drivers were running dry — and giving up, even though demand for rides was high because of the crippled public transit system. Northside Car Service in Williamsburg, Brooklyn, has 250 drivers available on a typical Thursday evening. This Thursday, they had just 20. "The gas lines are too long," said Thomas Miranda, an operator at Northside.

Betty Bethea, 59, waited nearly three hours to get to the front of the line at a Gulf station in Newark, but she brought reinforcements: Her kids were there with gas cans, and her husband was behind her in his truck.

Bethea had tried to drive to her job at a northern New Jersey Kohl's store on Thursday morning, only to find her low-fuel light on. She and her husband crisscrossed the region in search of gas and were shooed away by police at every closed station she encountered.

"It is crazy out here — people scrambling everywhere, cutting in front of people. I have never seen New Jersey like this," Bethea said.

But relief appeared to be on the way, even as the lines grew Thursday. The Environmental Protection Agency lifted requirements for low-smog gasoline, allowing deliveries of gasoline from other regions. Tanker trucks sped north from terminals in Baltimore and other points south with fuel.

A big delivery of fuel was on its way south to Boston from a Canadian refinery. Ports and terminals remained open in Connecticut, Rhode Island and Pennsylvania, and portions of the Colonial and Buckeye pipelines are expected to reopen today. Kinder Morgan Energy Partners expects to open its three terminals in New Jersey and New York over the next two days after bringing in backup generators.

And the U.S. Coast Guard opened the Port of New York and New Jersey to tankers Thursday.

Logistical problems will remain, though, for days. Barges can now visit terminals up the Hudson River and into Long Island Sound, but many of the major fuel hubs and terminals near the New York and New Jersey ports still can't offload fuel. They need to get electricity back, pump water out of flooded areas, and inspect equipment before starting operations again.