Budweiser brewer Anheuser-Busch has reached a contract agreement with the Teamsters union that avoids a strike at its U.S. plants.

The union had threatened a strike at the brewer’s 12 U.S. plants if an agreement on a new five-year contract wasn’t reached by 11:59 p.m. EST Thursday. The Teamsters union represents 5,000 Anheuser-Busch workers who brew and package beer and even take care of the company’s legendary Clydesdale horses.

But the two sides said late Wednesday they had reached a tentative agreement that boosts wages and increases vacation days and pension contributions.