The country's Government Communications Security Bureau (GCSB) had the internet millionaire under close surveillance as part of an investigation into his alleged copyright piracy and racketeering offences.
However, prime minister John Key has since ruled that the agency's actions were illegal because it is only permitted to spy on foreigners. Dotcom has held New Zealand citizenship for two years.
"I apologise to Mr Dotcom... We failed to provide that appropriate protection for him," said Key. "It is the GCSB's responsibility to act within the law, and it is hugely disappointing that in this case its actions fell outside the law."
The move comes as another boost for the Megaupload co-founder in his battle against extradition to the US, where government authorities want him to stand trial.
A New Zealand judge previously ruled that a search warrant executed during a raid on Dotcom's home was unlawful, and declared that the accused should be granted access to the evidence against him.
The extradition trial will take place in March 2013 after being postponed from August this year.