Pepco and its union struck a preliminary agreement Sunday night, probably averting a potential strike that had worried local officials and residents for weeks, the utility and union officials said Monday.

The agreement came after extensive negotiations during the weekend, officials said. Pepco and the union declined to provide specifics on the contract, which needs to be approved by the 1,100 members of the union, the International Brotherhood of Electrical Workers Local 1900. Union President James A. Griffin said the vote will probably occur next week.

“I’m grateful for the support the membership gave us during this difficult time,” Griffin said. Union leaders “will be recommending that the membership vote for this contract. But it will ultimately be up to the membership to vote on it.”

The company and union were at an impasse for months, and officials from both sides said they thought a strike was a real possibility. The old contract was set to expire in May.

The dispute involved Pepco’s linemen and electricians, the workers who are key to restoring service during outages. Given that the utility has suffered withering criticism over its reliability, Del. Tom Hucker (D-Montgomery) said Pepco “dodged a bullet” in resolving the contract dispute.

“Pepco is unreliable enough without labor problems,” said Hucker, a frequent Pepco critic. “Certainly, if they had a strike, people don’t need any additional unreliability from Pepco.”

Last month, Pepco offered its “last, best and final” offer, which was resoundingly rejected in a union membership vote. Union officials raised several objections to the offer, including a provision that would eliminate the union’s ability to arbitrate changes to its health and welfare plans in favor of a different appeals process.

In response, Pepco said it would not give workers retroactive increases on wages and benefits. The increases totaled about $1.1 million, or $1,000 a worker, Pepco spokeswoman Myra Oppel said. To smooth out tensions and resume negotiations, the utility and union brought in a federal mediator and called a media blackout.

On Monday, some analysts praised the agreement. Paul Patterson of Glenrock Associates, a New York investment research firm, said a possible strike was concerning because it could cause problems for customers during major weather events.

“For some reason, this company hasn’t been exactly lucky” with storms, Patterson said with a laugh. “The last thing we want is another reliability issue.”

The announcement follows other good news for the company, which serves 788,000 customers in the District and Maryland. The utility has been pushing for a controversial plan to allow electric companies to charge ratepayers in advance of serious maintenance upgrades. Last week, Maryland Gov. Martin O’Malley (D) expressed his support for the surcharge.

The plan would add about $1 or $2 to most Marylanders’ monthly electric bills. Consumer advocates have criticized the surcharge, saying it would essentially reward the utility for bad behavior.

Moreover, the D.C. Public Service Commission last month approved the majority of Pepco’s request to raise customer rates. Because of the ruling, the average residential bill will increase by $2.60 starting later this month.

The PSC did not respond to a request for comment Monday. Commission Chairwoman Betty Ann Kane said last month that the body wasn’t monitoring the labor dispute.

Regina L. Davis, a spokeswoman for the Maryland Public Service Commission, said the panel was monitoring the labor dispute but declined to comment on the agreement.