The United Nations Security Council wound up its debate on the issue of Jerusalem tonight and approved 14 to 0, with the United States abstaining, a resolution censuring Israel for its recent law formally declaring all Jerusalem its permanent and undivided capital.

It also asked all nations with embassies presently located in the holy city to remove them.

Secretary of State Edmund S. Muskie, broke away from a vacation in Maine to attend the final session, said the United States was abstaining on the resolution because it was "fundamentally flawed" by condemning only Israel and failed to view the issue within the context of the ongoing Egyptian-Israeli negotiations for an overall "just and lasting Middle East peace."

Attacking the U.N. preoccupation with the Middle East, he said the resolution "fails to serve the goal of all faiths that look to Jerusalem as holy" and called the demand for all nations to remove their embassies from there "not binding" and "without force."

In an apparent rebuke to Israel, Muskie also said the final status of Jerusalem "cannot simply be declared. It must be agreed to by the parties" involved in the dispute. But he also reassured Israel the United States would continue to oppose "firmly and forcefully" all attempts to impose sanctions against it.

The Netherland and a dozen Latin American nations previously had their embassies in Jerusalem, but several of them, notably Venezuela Ecuador and Uruguay, have already declared their intention to move them to Tel Aviv.

Arab nations, led by Saudi Arabia and Iraq, had earlier warned that they would sever economic and diplomatic relations with any country recognizing the new Israeli law.

On Friday the Security Council was already close to coming to an aggrement on wording close to that contained in today's resolution, but then postponed a vote as the Palestine Liberation Organization (PLO) undertook a vigorous lobbying campaign to get the world body to take stronger measures against Israel.

The PLO-backed resolution, introduced by three Moslem states on the Council -- Tunisia, Bangladesh and Niger -- sought to impose economic and trade sanctions against Israel for its stand on Jerusalem.

Since it was already known the United States and other Western nations on the council would veto such a resolution, it was generally assumed the PLO purpose was precisely to embarrass them and worsen their relations with the Arab world.

Some Western and Moslem diplomats charged in private that the PLO was acting at the instigation of the Soviet Union, anxious to see the West put in the embarrassing position of haveing to veto the stronger resolution.

Realizing the PLO-suported resolution was heading for a defeat, Moslem and Western European members of the council decided to return to the more moderate of the two opposing resolutions.

The Security Council resolution declares the Israeli law proclaiming all of Jerusalem the eternal and undivided capital of the Jewish state "null and vold" and says it "must be rescinded." It also censures Israel "in the strongest possible terms."

Meanwhile, Israel yesterday expressed its regret over Ecuador's decision to move its embassy from Jerusalem to Tel Aviv and charged that Arab economic pressure was responsible for it.

The Netherlands, the only Western European nation having its mission in Jerusalem, is expected to decide next week whether to follow the lead of the three Latin American nations which have already transferred their embassies.