China says foreign internet firms acting within the law are welcome to do business there.
A spokesperson from China's Foreign Ministry was responding to internet search giant Google's threat to pull out of the country because of hacking attacks and censorship.
Google said cyber-attacks originating in China aimed at rights activists, and increased web censorship, might force it to end its China operations.
The spokeswoman Jiang Yu said Chinese law proscribes any form of hacking activity.
Google said earlier this week that it was no longer willing to censor results on its Chinese search-engine to remove issues Beijing deems politically sensitive.
The company said it would hold talks with the government in the coming weeks to look at operating an unfiltered search engine within the law in the country, though no changes to filtering have yet been made.