Beijing will take “necessary measures” to protect Chinese firms against new restrictions, foreign ministry said.