The U.S. Supreme Court agreed to hear Facebook Inc.’s bid to stop a lawsuit that accuses the social-media giant of sending unwanted text messages in violation of federal law.

Facebook contends that, in letting the suit go forward, a federal appeals court misinterpreted a federal law that bans robocalls to mobile phones. The suit seeks class-action status.

The Supreme Court had deferred acting on the appeal while it resolved a separate dispute over the reach of the 1991 Telephone Consumer Protection Act.