RICHMOND, Va.—A federal court ruled Monday that a key part of the health-care overhaul violates the Constitution, dealing the first legal setback to the Obama administration's signature legislative accomplishment.

U.S. District Judge Henry E. Hudson said the law's requirement that most Americans carry insurance or pay a penalty "exceeds the constitutional boundaries of congressional power."

The...