WASHINGTON—The Supreme Court on Monday shielded Secretary of Commerce Wilbur Ross from being questioned under oath about the government’s decision to ask people on the 2020 census whether they are U.S. citizens.

The court, in a brief written order, stayed the effect of a lower-court ruling that had required Mr. Ross to sit for a deposition conducted by lawyers for a group of 18 states and other plaintiffs who are challenging the lawfulness of the administration’s move to add the citizenship question.

The...