WASHINGTON—The U.S. and Mexico unveiled a deal Thursday to resolve a longstanding dispute over cross-border trucking, an agreement that could help ease tense relations between the two neighbors.

The deal seeks to end a nearly 20-year ban on Mexican trucks crossing the U.S. border, a violation of the North American Free Trade Agreement that subjected $2.4 billion of U.S. goods annually to punitive tariffs by Mexico. Half of the tariffs will be suspended when the deal is signed by both nations, expected in about 60 days. The remainder will be lifted when the first Mexican hauler complies with a series of U.S. certification requirements, including English-language, drug and safety tests.

The new requirements for Mexican trucks are tougher than those established in Nafta and somewhat tougher than those currently in force for American truckers. Specifically, Mexican trucks will have to carry electronic recorders to ensure they do only cross-border, not domestic, runs and to track compliance with U.S. hours-of-service laws.

Nonetheless, the agreement appears to be a setback for U.S. labor unions, which have backed the ban in its various incarnations and opposed some other Obama administration trade initiatives, including efforts to conclude a trade pact with Colombia. Unionized U.S. truckers say the plan threatens their jobs.

The trucking deal "caves in to business interests at the expense of the traveling public and American workers," said International Brotherhood of Teamsters president Jim Hoffa. The union has long said that Mexican trucks and drivers are potentially unsafe, which the Mexican government disputes.