School bus drivers who work for the private transport company First Student ratified a contract Wednesday night, a company spokesman said, ending a labor dispute that had had the potential to close schools across the state.

Drivers out of the company’s Belmont facility, which serves school districts in Alton, Gilford, Gilmanton, Laconia and the Shaker Regional school district, had threatened to strike over retirement benefits.

The union representing drivers in Belmont accepted a five-year contract Wednesday from the company at a meeting in Tilton. Drivers voted 33-1 in favor of ratifying the contract and are now prepared to return to work.

Despite the company warning that employees not working at the Belmont location had “no strike” clauses barring them from stopping work, the union had said it might be setting up picket lines at facilities across the state.

First Student, which contracts with more than 30 districts in the state, offered drivers a new deal last week.