Pennsylvania power companies said Thursday they have restored service to a majority of customers knocked out by Hurricane Sandy, while 1.6 million electricity customers in hard-hit New Jersey are still off the grid.

"We had massive damage to our infrastructure," said Chris Eck, a spokesman for Jersey Central Power & Light Co., which had restored service to only 31 percent of the 1.2 million customers that were knocked out by the storm.

Pennsylvania utilities said nearly all of their customers would be restored by this weekend. But JCP&L and Public Service Electric & Gas Co. in New Jersey are warning customers that many will remain powerless until the middle of next week.

The New Jersey utilities lost numerous substations to floods, in addition to losing power lines and pole-top transformers. The substations, which serve large areas of customers, must be drained, dried and cleaned before they can be reenergized.

Ralph A. LaRossa, PSE&G's president, said Thursday that cleanup crews were engaged in "hand-to-hand combat" with filth in substations, using toothbrushes and rags to remove dirt.

Atlantic City Electric Co., which serves most customers in South Jersey's Shore communities, said it aimed to restore service to mainland customers by Friday and customers on barrier islands by Sunday.

Electricity customers suffered the brunt of the utility service disruptions from the hurricane, while the region's water utilities survived relatively unscathed.

Most water purveyors said their operations were saved by extensive use of diesel-power generators, which kept treatment systems and pumps operating while the electrical grid collapsed.

The New Jersey Department of Environmental Protection said 17 water systems issued alerts to customers to boil their tap water because of power disruptions or because water-treatment systems were flooded.

Atlantic City was among the largest systems that issued a boil-water alert. Ship Bottom and Long Beach and Stafford Townships also told customers to boil their water as a precaution.

But for most water customers, the taps kept flowing.

"Just about all of our systems were on backup power," said Richard Barnes, a spokesman for New Jersey American Water.

Seventeen of 70 Aqua America facilities in Pennsylvania were still using backup power generators Thursday, said Donna Alston, a spokeswoman for the Bryn Mawr water company.

But a new challenge is emerging for some water companies that have kept their systems afloat despite power outages - the fuel needed to operate diesel generators is in short supply in the hardest-hit areas.

Supplies of gasoline and diesel are running short in the New York area. State and federal regulators have waived emissions rules, allowing operators of large diesel generators to use heating oil as a replacement fuel.

"We're hopeful the power grid has stabilized and we don't have to rely on fuel deliveries for much longer, which have been unreliable," said Steven Goudsmith, a spokesman for United Water, which serves about 200,000 customers in the northern part of New Jersey.

Backup power systems were insufficient to save some customers, however.

Two hospitals in New York had to be evacuated because their on-site generators failed. At New York University Langone Medical Center in lower Manhattan, the basement generators were swamped. And at Bellevue Hospital Center, the basement fuel pumps that deliver diesel to generators on the 13th floor were knocked out by floodwaters.

"When you take those perfectly good systems and put them under water, they don't work as intended," said Allen Schaeffer, executive director of the Diesel Technology Forum, the industry's trade group.

"I'm sure there's going to be a lot of re-evaluation of systems after the storm," he said.

Contact Andrew Maykuth at 215-854-2947, @Maykuth on Twitter or amaykuth@phillynews.com.