The steering agreements were justified in these circumstances, Justice Thomas wrote.

“While these agreements have been in place,” Justice Thomas wrote, “the credit-card market experienced expanding output and improved quality. Amex’s business model spurred Visa and Mastercard to offer new premium card categories with higher rewards. And it has increased the availability of card services, including free banking and card-payment services for low-income customers who otherwise would not be served.”

Chief Justice John G. Roberts Jr. and Justices Anthony M. Kennedy, Samuel A. Alito Jr. and Neil M. Gorsuch joined the majority opinion.

Justice Stephen G. Breyer read his dissent from the bench, a rare move indicating profound disagreement. He said the implications of the ruling were vast and could hurt competition in many realms.

“I particularly fear the interpretive impact of the majority’s discussion of what it calls ‘two-sided platforms,’ in an era when that term might be thought to apply to many internet-related goods and services that are becoming ever more important,” Justice Breyer said.

Merchants expressed disappointment with the decision.

“Today’s ruling is a blow to competition and transparency in the credit card market,” said Stephanie Martz of the National Retail Federation. “The American Express rules in question have amounted to a gag order on retailers’ ability to educate their customers on how high swipe fees drive up the price of merchandise.”

American Express issued a statement saying the long court battle was “well worth the fight because important issues were at stake: consumer choice, fair market competition, and the ability to deliver innovative products and services to our customers, both consumers and merchants.”

In 2010, the Justice Department and 17 states sued several credit card companies, saying that their steering practices had violated the antitrust laws. Visa and Mastercard settled, but American Express fought the case.