SAN FRANCISCO—The U.S. Court of Appeals for the Ninth Circuit on Tuesday ruled that arbitration agreements between companies and consumers are enforceable under California law, even if they require the losing party to pay attorney fees and the costs of the proceedings.

The decision hands a victory to genetic testing kit company 23andMe Inc., which was hit with a slew of consumer suits after federal regulators ordered it to stop making health claims about its product.