After six months of bargaining, Waste Management of Alameda County and Machinists Local 1546 have reached an agreement that includes specialized training for about 80 workers, who will in turn pay a larger share of their health and pension costs but avoid potential layoffs.

The agreement, announced Monday, is designed to reduce outsourcing of maintenance of Waste Management trucks, which run on liquid natural gas and require specialized knowledge and tools.

The savings from keeping maintenance in-house instead of relying on third-party mechanics would help fund training for workers at the 98th Avenue facility in Oakland, the Davis Street Transfer Station and Materials Recovery Facility in San Leandro, and the Altamont Landfill. Workers who upgrade their skills will be eligible for raises, Waste Management spokesman David Tucker said.

The agency did not disclose pay rates or details about how much workers would contribute to their benefits and pensions costs. The six-year agreement is retroactive to July 2012. Waste Management of Alameda County serves more than 194,000 residential households and 14,000 commercial customers.