SAN FRANCISCO — Facebook Inc. on Tuesday was hit with a class action claiming the company sends spam text messages to people who get assigned cellphone numbers that used to belong to Facebook users.

The suit, filed in U.S. District Court for the Northern District of California by lawyers at privacy specialty firm Edelson P.C., highlights the headaches created for online communication services like Facebook when cellular carriers recycle previously used phone numbers.