A senior Chinese diplomat said on Friday an attack on Iran would invite devastating retaliation that would envelop the region and destabilize the global economic recovery, and added that the international community had to restrain itself from war.
Iran is locked in a dispute with the West over its nuclear program, which Iran says is for peaceful purposes.
Israel and the United States have threatened military action against Iran unless it abandons activities which the West suspects are intended to develop nuclear weapons.
China, which has close energy and trade ties with Iran, has urged a negotiated solution to the dispute and long opposed the use of force or unilateral sanctions on Iran.
The comments by Chen Xiaodong, head of the Foreign Ministry's West Asia and North African affairs division, was China's strongest warning yet not to use force to resolve the dispute.
"If force is used on Iran, it will certainly incur retaliation, cause an even greater military clash, worsen turmoil in the region, threaten the security of the Strait of Hormuz and other strategic passages, drive up global oil prices and strike a blow at the world economic recovery," he said.
"There may be 10,000 reasons to go to war but you cannot remedy the terrible consequences of plunging the people into misery and suffering and the collapse of society and the economy caused by the flames of war," Chen said on a web chat hosted by Communist Party mouthpiece the People's Daily.
Speculation is growing that Israel could launch some form of strike against Iranian nuclear installations, which Israel sees as a threat to its existence.
During a visit to Beijing last month, Israel's foreign minister hinted it could launch a preemptive attack on Iran despite repeated calls by China to allow diplomacy to take its course.
Chen said the pressing task was for all sides to restrain themselves and resume dialogue as soon as possible.
"The international community has a responsibility to restrain itself from war," he said.
More talks between Iran and world powers are expected to take place this month in an attempt to reach a compromise.
The most recent talks failed in January 2011 after Iran refused to suspend its uranium enrichment work, as demanded by the United Nations in several resolutions.