In a last-minute reversal, Samsung Electronics reached a tentative deal with its labor union, averting a potentially crippling strike that had been scheduled to start Thursday at the world’s largest memory chipmaker.

The South Korean company said late Wednesday that “labor and management have reached a tentative agreement on wages and the collective bargaining agreement.” The company’s union also confirmed suspension of plans for a strike that had been planned for May 21 to June 7.

The news follows days of back-and-forth brinkmanship and high-pressure negotiations. On Wednesday morning, labor leader Choi Seung-ho said the work stoppage would go ahead on Thursday after Samsung’s management rejected a proposal from government mediators that the union had accepted.