OTTAWA -- A potential trade war between Canada and the United States was averted Friday when Congress passed a massive spending bill that also repealed a controversial meat labelling law.

The 2,000-plus pages of legislation contained a two-page rider that scrapped the U.S. labelling law, known as COOL, which had become a major irritant among Canada, Mexico and the U.S.

President Barack Obama formally signed the bill Friday to complete the legislative process.

The World Trade Organization granted Canada and Mexico the right to impose $1 billion in punitive tariffs on various U.S. products after finding that the country-of-origin labelling provisions on beef and pork products violated international trade rules.

Canada and Mexico argued that the measure was nothing more than thinly disguised protectionism. Supporters said consumers have a right to know where their meat comes from.

International Trade Minister Chrystia Freeland and Agriculture Minister Lawrence MacAulay both welcomed the passage of the legislation, calling Friday "a great day for Canada."

"This is a real vindication of the power and significance of the WTO dispute-resolution mechanism, which has secured a real win for Canada," Freeland said in a teleconference call from Nairobi, where she and MacAulay were taking part in a trade conference.

"This is a decision that will have a real and immediate benefit to the Canadian economy."

Freeland said she expects the labelling regime will disappear quickly.

"We will be monitoring the situation to make sure there are no problems in this area," MacAulay added.

The ministers thanked Canadian diplomats and some American politicians and industries which supported doing away with the measure.

The Senate had been the last barrier because domestic political interests kept some senators opposed to repealing the law.

Kansas Sen. Pat Roberts, the Republican chair of the Senate's powerful agriculture committee, expressed relief Friday at the news. Roberts said the retaliatory measures would have been damaging to various sectors of the U.S. economy.

"From the ranchers in Kansas to the jewelry makers on the East Coast, every state had something to lose from keeping mandatory COOL intact," Roberts said in a statement.

The WTO ruling, the latest in a series that Canada won in the dispute, cleared the way for widespread retaliation.

The targeted U.S. products included not only agricultural ones such as cattle, pork, apples, rice, maple syrup and wine, but extended to non-agricultural products, such as jewelry, office chairs, wooden furniture and mattresses.

Freeland said Canada still intends to obtain formal approval next week from the WTO for retaliation, even though the tariffs won't be imposed.

"We think that it is prudent of us to take the legal process to its formal, technical conclusion," she said.

On Friday, the Senate voted by a 65-33 margin to approve the massive bill that included $1.14 trillion in new spending in 2016 and $680 billion in tax cuts in the decade to come.