"The governor of the province of North West Frontier Province may not assent to the Hisba (accountability) bill in its present form," the Supreme Court said in its order.
The province's assembly, which is dominated by a coalition of Muslim parties, on 14 July approved the bill that called for establishment of a department to ensure adherence to "Islamic values at public places".
A provincial bill must be approved by the provincial governor, who is appointed by Islamabad, before it can become law.
The nine-member court bench noted that many of the provisions in the bill violate the country's 1973 constitution.
The court had sat for four days to hear a challenge by the federal government against the legislation.
The issue was referred to the Supreme Court by President Pervez Musharraf.
Reasons to be given later
The bench said it would give reasons for its decision later and explain which parts of the provincial legislation are against the constitution.
"We will introduce the bill again with some amendments," Malik Zafar Azam, the province's law minister, told reporters in the Supreme Court after its ruling.
The six-party Mutahida Majlis-e-Amal or United Action Forum won parliamentary elections in 2002 in Pakistan's North West Frontier Province.