An ILWU spokeswoman did not immediately return messages seeking comment. Pat McCormick, a spokesman for the grain companies, said he needed to be briefed on the deal before making a statement.
More than a quarter of all U.S. grain exports move through nine grain terminals on the Columbia River and Puget Sound.
The conflict started after a labor contract expired Sept. 30, 2012. It began to boil three months later, when United Grain and two other Pacific Northwest grain terminals declared an impasse and enforced a contract that included new, management-friendly workplace rules.
United Grain, based in Vancouver, Washington, imposed a lockout in February 2013, after determining a worker shoved a metal pipe into a conveyor and poured sand into a gear box. Longshoremen said the response was extreme and illegal, and they established a picket line at the Port of Vancouver.
Ronald Hooks, regional director of the National Labor Relations Board in Seattle, later determined that United Grain unfairly locked out the workers. The company disputed the finding. A National Labor Relations Board administrative law judge had been scheduled to hear the matter.
Separately, Hooks said locked-out picketers violated labor law by engaging in threats and violence in the early months of the lockout. For example, he said, picketers threw rocks at a security officer and blinded truck drivers with spotlights. An administration law judge was also scheduled to hear these claims.
The agreement comes shortly after U.S. Department of Agriculture grain inspectors refused to cross the picket line into the United Grain terminal, which has the largest storage capacity of any West Coast grain-export facility.
United Grain requested federal grain inspectors because Washington state inspectors stopped entering the terminal, citing safety concerns. The state inspectors took that step after Gov. Jay Inslee ordered state highway patrol officers to stop providing security for them.
Federal law requires inspections for grain exports, so the refusal to cross the picket line crippled shipments from that major terminal and put pressure on the owner to reach a deal.
"United Grain Company has been notified that state grain inspectors will resume inspections immediately," Inslee said in a statement Tuesday.
The contract dispute initially involved six terminals that operate under a single collective bargaining agreement with the ILWU: United Grain, based in Vancouver, Washington; Columbia Grain, based in Portland, Oregon; Louis Dreyfus Commodities, which has grain elevators in Portland and Seattle; and Temco, which has elevators in Portland and Tacoma, Washington.
Temco broke away from the alliance in December 2012 and reached a deal with the union.
Columbia Grain, based at the Port of Portland, locked out workers in May 2013.
The dispute was primarily about workplace rules. The grain companies have said that they are at a competitive disadvantage because the longshoremen at their terminals had more favorable rules than those in the Washington cities of Kalama and Longview.
Early contract offers from the grain handlers would have taken away some perks and grievance procedures.