The resolution, which passed 106-9 with 40 abstentions, also called on Iran to cooperate with any countries trying to bring to justice those who planned, sponsored or attempted to carry out the alleged plot, the United Nations said in a release. Two suspects were indicted on charges in the case last month.
The U.N. members said they were "alarmed" by efforts to attack diplomatic and consular representatives.
Acts of violence against diplomatic missions or inter-governmental organizations or their officials "can never be justified," the resolution said.
Iran's attempts to amend the resolution failed.
The White House issued a statement saying it welcomes the "strong vote" in the United Nations.
"The widespread support for this resolution, which was co-sponsored by U.N. members from all regions of the world, sends a strong message to the Iranian government that the international community will not tolerate the targeting of diplomats," the statement by the White House press secretary said. "We will continue to work closely with our allies and partners around the world to ensure that Iran understands that such outrageous acts only deepen Iran's isolation."
Manssor Arbabsiar and Gholam Shakuri were indicted by a federal grand jury in New York on charges they sought to kill Saudi Ambassador Adel al-Jubeir. Arbabsiar is in custody and Shakuri is still at large.
President Barack Obama has said Shakuri "had direct links, was paid by and directed by individuals in the Iranian government."
The Iranian Foreign Ministry has said the accusations are groundless. Iranian media have said Shakuri is an operative of an exiled Iranian opposition group.