(Reuters) - Amazon.com Inc on Thursday won a more than $1.5 billion tax dispute with the Internal Revenue Service over transactions involving a Luxembourg unit more than a decade ago.

Judge Albert Lauber of the U.S. Tax Court rejected a variety of IRS arguments, and found that on several occasions the agency abused its discretion, or acted arbitrarily or capriciously.

Amazon's ultimate tax liability from the decision was not immediately clear.

The world's largest online retailer has said the case involved transactions in 2005 and 2006, and could boost its federal tax bill by $1.5 billion plus interest. It also said a loss could add "significant" tax liabilities in later years.

Amazon made just $2.37 billion of profit in 2016, four times what it made in the four prior years combined, on revenue of $136 billion.

Lauber's decision "should shield Amazon from potentially significant tax obligations to the IRS covering years beyond the ones covered in the lawsuit," said Colin Sebastian, an analyst at Baird Equity Research.

The IRS declined to comment. Amazon and its lawyer John Magee, a partner at Morgan, Lewis & Bockius, also declined to comment.

Before entering the White House, President Donald Trump contended that Amazon, run by billionaire Jeff Bezos, failed to pay enough taxes, once accusing it on Fox News of "getting away with murder tax-wise."

The IRS case involved "transfer pricing," which arises when different units of multinational companies transact with each other.

Amazon argued that the IRS overestimated the value of "intangible" assets, such as software and trademarks, it had transferred to a Luxembourg unit, Amazon Europe Holding Technologies SCS.

Lauber said Amazon did this through a plan called "Project Goldcrest," to have the "vast bulk" of income from its European businesses taxed in Luxembourg at a "very low rate."

The IRS countered that Amazon's dealings were not all done at "arm's length," or else improperly lowered its domestic tax bill.

"This is good for everybody, not just Amazon," said Michael Pachter, a Wedbush Securities analyst who has practiced tax law. "It reaffirms that the tax law permits wholly-owned subsidiaries can license intellectual property" as Amazon did. "Totally legal, totally legal."

Amazon has said it may face additional tax bills in Europe if authorities in Brussels conclude that prior rulings by Luxembourg tax officials amounted to improper "state aid" that gave it an unfair advantage over rivals.

A formal probe into those rulings began in October 2014, Amazon has said.

(Reporting by Dena Aubin and Jonathan Stempel in New York, and Jeffrey Dastin in San Francisco; Editing by Richard Chang)