National Grid and the Brotherhood of Utility Workers Council averted a threatened strike and came to a tentative agreement late Saturday night, less than three hours before their contract was set to expire.

The electricity and natural gas delivery company will maintain current staffing levels in the region and the more than 1,200 workers in Massachusetts and Rhode Island represented in negotiations will get a 2.5 percent raise each year under the terms of the tentative four-year deal, according to Dan Hurley, the president of the Brotherhood of Utility Workers Council.

Hurley called the the tentative accord, reached just after 9 p.m. Saturday, a “fair agreement,” emphasizing that National Grid’s proposed staffing cuts were avoided. He declined to say what concessions the unions made in the talks and said his membership had not yet been briefed on all the details.

Advertisement - Continue Reading Below

The proposed agreement will be presented for ratification to the members of the six unions involved in the talks on May 20, Hurley said.

Deborah Drew, a spokeswoman for National Grid, confirmed that a contract agreement had been reached. She declined to confirm any other details.

“We’re very happy to have reached an agreement with our union partners,” she said in a statement. “We’re hopeful that the union membership will ratify the respective agreements. We believe this is an agreement that meets the needs of both our employees and our customers.”

In April, the Brotherhood of Utility Workers Council voted to authorize a strike against National Grid if a new agreement was not reached.

National Grid has about 3.3 million electricity customers in Massachusetts, Rhode Island, and New York, according to the company.