Justice Helen Winkelmann has ruled that the Government Communications Security Bureau (GCSB) must disclose when it was first asked by police to spy on Dotcom and his associate Bram van der Kolk.
She has also granted an application for the GCSB to be added as a defendant in the ongoing judicial review of the lawfulness of the police raid on Dotcom's mansion in January, when he was arrested on allegations of internet piracy and racketeering.
That opens the door for Dotcom and van der Kolk to seek damages and declarations about the legality of the GCSB's actions.
The agency has already admitted that it acted illegally, because Dotcom and van der Kolk are New Zealand residents and it is forbidden by law to spy on citizens or residents.
Under Justice Winkelmann's ruling, the GCSB must hand over to the courts all the information it collected when it intercepted Dotcom's communications.
Green Party co-leader Russel Norman said that it's outrageous that taxpayers could end up footing a huge bill.
"Prime Minister John Key is responsible, he is the minister in charge of the GCSB and this happened under his watch," Dr Norman said. "He didn't monitor what they were doing."
NZ First leader Winston Peters said that Dotcom will be able to sue the government, the police, and the GCSB.
"This will end up costing taxpayers millions of dollars in legal fees to fight the case and in compensation to Dotcom," he said.
US authorities have laid charges against Dotcom, and an extradition hearing is due to start next year, probably in June or July.
Dotcom said in October that he would prefer not to sue.
"We love it here, and we don't want to burden taxpayers."