BATH — Bath Iron Works and its largest unions have reached a tentative agreement on a four-year contract, both sides said today.

The contract improves pensions and wages and “holds the line” on health care costs for employees, said John Carr, a spokesman for the International Association of Machinists and Aerospace Workers.

The union, which represents about 3,200 mechanics, fitters, welders, painters and electricians, will vote on the tentative deal Sunday. Additional details on wages and other provisions of the contract proposal were not immediately available.

“The negotiating committee brought back a tentative agreement that is the leader in the shipbuilding industry,” Carr said.

“We’re pleased the negotiating teams have achieved a tentative agreement. We believe this is a fair and equitable offer which provides competitive wages and benefits to our employees while placing the company in a good position to compete for future shipbuilding contracts,” said Jim DeMartini, a spokesman for Bath Iron Works.

The tentative agreement was reached at midnight on Wednesday, said the company, which is a unit of General Dynamics Corp. The Local S6 negotiating committee is unanimously endorsing the company’s offer to the membership, Bath Iron Works said.

If the contract proposal is rejected by union members, a strike-authorization vote would take place. A strike could begin at 12:01 a.m. on May 21 if the proposal fails, Carr said.