"Tibet is an inseparable part of China," foreign ministry spokeswoman Hua Chunying said at a regular briefing, adding the region's affairs are a Chinese "domestic" matter.
"We are firmly opposed to any country or any individuals' interference in China's domestic affairs under the pretext of the Tibet-related issue," she said.
Hua's comments came after a Spanish court agreed to hear a lawsuit against Hu as part of an investigation into whether he carried out genocide in Tibet in the 1980s and 1990s.
The court decided to hear the complaint after accepting an appeal against a decision by Judge Ismael Moreno, who in June had rejected it, according to a judicial decree published on Thursday.
Since 2006, Moreno has been hearing a lawsuit for alleged genocide against various former Chinese leaders over repression carried out in Tibet in the 1980s and 1990s.
The lawsuit, which was filed by the Tibet Support Committee, targeted seven past Chinese leaders, among them former president Jiang Zemin and former prime minister Li Peng.
It asked for Hu to be charged once his immunity as head of state expired. He stepped down in March this year.
The court on Thursday accepted the allegations of the plaintiffs against Moreno's decision to say that Hu "had sufficient organic competency and capacity to lead a series of actions and campaigns tending to harass the Tibetan population".
Considering that "during the diverse campaigns of repression in Tibet between 1988-1992, he held the post of Chinese communist party secretary in the region of Tibet", it said.
Hua emphasized that China and Spain have "friendly relations" to which both sides "attach great importance".
She said that the organization behind the lawsuit is "attempting to attack the Chinese government and sabotage friendly relations between China and the relevant country", referring to Spain.
She said China hopes that the Spanish government will "not provide any platform or opportunity" to those behind the court case for what she termed "anti-China separatist activities".
"We also hope that they (the Spanish government) will take measures to ensure the sound and steady growth of our bilateral relations."