The government's legal difficulties underline how hard it is for some of southern Europe's heavily-indebted countries, like Portugal, to overhaul long-standing labor rights.
The legal obstacles have thwarted some debt-reduction measures and helped prolong the financial crisis tormenting the 17 countries sharing the euro currency for more than three years.
The center-right coalition government made no immediate comment on the court's decision, but it will have to find the savings elsewhere as the country's bailout creditors demand cuts before releasing loan disbursements.
The government has abided by those demands despite complaints from opposition parties and trade unions that austerity is keeping Portugal in recession. The bailout creditors predict the economy will shrink 2.3 percent this year. The jobless rate is 16.4 percent.
Another law, increasing the working week of civil servants to 40 hours from 35, is due to come into force at the end of September, but unions have said they will ask the Constitutional Court to rule on its lawfulness.