"Listen up, Taiwan is not part of the PRC [People's Republic of China] & certainly not for sale!," foreign minister Joseph Wu said on Mr Musk's X.
Just this week, China conducted air and naval drills around Taiwan, in what has become a routine show of military might around the island. Taiwan said that it had detected more than 40 Chinese military aircraft and about 10 ships in its waters.
This is not the first time that Mr Musk, who has business interests in China, has angered Taiwan's government with his comments. In October, he suggested that tensions between Beijing and Taipei could be resolved by giving China some control over Taiwan.
He said then in an interview with the Financial Times that he believed the two governments could reach a "reasonably palatable" arrangement. China's ambassador to the US had praised Mr Musk but his Taiwanese counterpart said something similar to Mr Wu - that freedom is "not for sale".
Mr Wu also posted on X: "Hope Elon Musk can also ask the CCP [Chinese Community Party] to open X to its people." Mr Musk's micro-blogging platform X, formerly known as Twitter, is banned in China.