The Trump administration scored a victory against Mexico this week in a longstanding trade battle.

The U.S. and Mexico have been locked in a dispute over how tuna is fished in Mexico. The U.S. claims that Mexican fishermen allow dolphins to be netted and killed when they fish for tuna. Therefore, U.S. officials say that Mexican tuna fish can't be labeled "dolphin safe."

Mexican leaders deny that the country's fishing industry isn't in compliance with rules imposed by the World Trade Organization and they demand their tuna get the "dolphin-safe" labeling. If it doesn't get that label, several major U.S. supermarkets, like Walmart, won't sell it, even though it can still legally cross the border.

In April, the WTO said Mexico had the right to impose tariffs on up to $163 million of U.S. exports, arguing that the U.S. labeling requirements for "dolphin safe" unfairly discriminated against Mexican tuna.

The WTO said $163 million was an amount equal to what Mexico had lost as a result of not having the U.S. label.

But in a separate proceeding this week, the WTO said that the U.S. labeling is now in compliance with its standards after a unit of the U.S. Commerce Department tweaked its tuna-labeling laws last year.

In other words, the ruling from Thursday means the U.S. labeling doesn't discriminate against Mexican tuna.

This week's ruling all but dismisses the retaliation decision in April, though it hasn't been officially thrown out. Mexico actually never decided to impose tariffs on U.S. exports.

Related: NAFTA Round 4 ends on a gloomy note

"I am pleased that WTO panels have finally agreed with the overwhelming evidence that U.S. dolphin-safe labeling requirements are accurate and fair," U.S. Trade Representative Robert Lighthizer said in a statement.

Mexico's economy ministry said it would appeal the WTO's ruling this week.

The ruling comes at a critical time for trade relations between the U.S., Mexico and Canada. Leaders from all three countries are renegotiating NAFTA, the free trade pact.

Negotiators ended the latest round of talks last week with a gloomy tone, with Mexico and Canada openly criticizing U.S. proposals. Lighthizer fired back at the same press conference, lambasting Canada and Mexico for what he called an unwillingness to compromise.

President Trump routinely threatens to pull out of NAFTA, and he's blamed it for the loss of hundreds of thousands of jobs lost to Mexico. NAFTA became law in 1994.

As for tuna, Mexican tuna exports to the United States have averaged about $15 million a year over the last five years, according to USTR. That makes up almost 3% of all tuna imports to the United States.