The Court of Appeal has overturned a ruling that would have allowed rival grocery firms to bid for discount retailer, The Warehouse Group.
The Warehouse is the country's biggest retailer, selling groceries in some of its stores.
The Commerce Commission does not want a takeover from either of the supermarket giants, saying it would lessen competition in the marketplace.
"We do see this as a victory for consumers and for competition, in what is a very important market to all New Zealanders," says the Commerce Commission's Paula Rebstock.
Foodstuffs and Woolworths control 99 per cent of New Zealand's grocery market. They argued that even if one of them bought The Warehouse, there would still be plenty of competition in the grocery trade.
But the commission and the Court of Appeal disagreed.
"Without The Warehouse, Foodstuffs and Woolworths would have little or less incentive to reduce prices, improve quality and bring innovation to the marketplace," says Rebstock.
Woolworths Australia and Foodstuffs say they are disappointed by the decision, and want time to study the Court of Appeal's decision.
Within minutes of the sharemarket opening, The Warehouse's share price had plunged more than 20 percent.
"When something like this happens, people tend to shoot first and ask questions later," says Grant Collie from Forsyth Barr.
It is believed the supermarket chains could appeal to the Supreme Court.
Some in the markets think Warehouse founder Stephen Tindall may now revive his plans to buy the whole company.