Juan Zaragoza, Puerto Rico’s treasury secretary, said in a statement that the treasury believed the federal court had no jurisdiction and should not have handled the case.

“For this reason, from the beginning, we contemplated the possibility of appealing a decision unfavorable to the interests of the people of Puerto Rico,” Mr. Zaragoza said. Officials were still analyzing the lengthy opinion, he said, but would appeal soon. “We will raise on appeal all the procedural errors that, in our opinion, took place during the trial,” he said.

The dispute began in 2015, when Puerto Rico amended its alternative minimum tax for companies. That type of tax tries to catch those who might otherwise use loopholes to avoid paying what they owe. Companies calculate their taxes each way, then pay the higher amount.

The tax changes included a big increase in the rates for companies operating big-box stores on the island. Walmart said in its lawsuit that the highest new rate was reserved for businesses on the island with revenue of more than $2.75 billion, and the only company that met that description was Walmart.

Puerto Rico has had trouble balancing its budget every year for at least a decade. It accumulated a $72 billion debt, in part, by issuing long-term bonds just to get the cash to balance its budget, a practice widely considered unsustainable. At the time the legislature was amending the alternative minimum tax, it was trying to plug a $125 million budget hole.

Walmart also cited evidence that Puerto Rican lawmakers had sought to raise its taxes high enough to pay for other businesses on the island to get a tax reduction. Walmart argued that this violated its rights under the Equal Protection Clause of the United States Constitution, and Judge Fusté agreed.