WASHINGTON—Consumers can sue Apple Inc. for forcing them to buy apps exclusively from the tech giant, the Supreme Court ruled Monday, threatening billions of dollars in revenue that the company is counting on to make up for slowing iPhone sales.

The antitrust suit alleges consumers pay inflated prices because Apple requires that all phone software be sold and purchased through the company’s App Store. Apps would be cheaper if software developers could sell them directly and bypass Apple as a middleman, the lawsuit alleges.

Apple typically takes a 30% cut of every app it sells, and a 15% cut of subscriptions sold through the app store after subscribers’ first year. The consumer lawsuit also complains about other App Store rules that affect pricing, such as Apple’s requirement that every app price point end in “99 cents,” meaning developers can only set prices in one-dollar increments like $1.99, $2.99 and so forth.

The Supreme Court’s decision focused on a preliminary issue in the case: whether consumers had a right to sue Apple over these practices. The court, in a 5-4 opinion by Justice Brett Kavanaugh, said they did.

The court rejected Apple’s arguments that consumers can’t sue because it is the app developers, not the company, that set app prices.