The vote in New York on Monday was 90 to 8 in favour, with 74 abstentions. Opposing the resolution were the United States, Israel, Australia, Ethiopia and the Pacific islands of Nauri, Marshall Islands, Micronesia, and Palau.
Almost all delegations, including the US, spoke against the apartheid wall, 150-km network of fences, wire, concrete walls and trenches that snakes across the West Bank.
But the European Union joined the unusually high number of abstentions, believing that seeking an opinion from the court was legally questionable and would work against a political dialogue.
Arab nations asked for the emergency session after UN Secretary-General Kofi Annan reported on 28 November that building the barrier was causing serious harm to Palestinians. He said Israel had a right to defend its citizens but that duty should not contradict international law.
"The wall is a false excuse used as a justification for colonising our land and establishing settlements," Palestinian UN observer Nasir al-Kidwa said.
Palestinian envoy Nasir al-Kidwa:
The wall is an immense war crime
He said that until the barrier came down there would be no peace settlement according to the US-backed "road map".
"For us it is either the wall or the road map. If Israel continues building the wall this will be the end of the road map and there must be a reaction to that," al-Kidwa said.
He called the Israeli government a "fascist occupier" and the barrier "an immense war crime" that has resulted in the "enslavement of the Palestinian people".
Israel blames Arafat
But Israeli Ambassador Dan Gillerman laid the blame for the barrier on Palestinian President Yasir Arafat.
Palestinian schoolchildren pass
through the apartheid wall
"Let me be perfectly clear. This is the Arafat fence. This is the fence that Arafat built. His terrorism initiated it, and made its construction inevitable. If there were no Arafat, there would be no fence," Gillerman said.
James Cunningham, the US representative, said the Bush administration opposed the barrier.
But he said the resolution was "one-sided and completely unbalanced" and did not even "mention the word terrorism".
The Hague-based UN court was set up to settle legal disputes between states and give advisory opinions if it decides they fall under its jurisdiction.
An opinion by the court would add to diplomatic pressure on Israel and carries more legal weight than a General Assembly resolution, which is nonbinding.
Monday's resolution, sponsored by 27 nations, said the barrier violated the 1949 UN-brokered Armistice (Green Line) boundary, after Arab states attacked Israel, and "de facto annexes large areas of territory."
The resolution asks the International Court of Justice "to urgently render an advisory opinion on the following question:
"What are the legal consequences arising from the construction of the wall being built by Israel ... described in the report of the secretary-general, considering the rules and principles of international law, including the Fourth Geneva Convention of 1949, and relevant Security Council and General Assembly resolutions?"