The United Nations general assembly voted overwhelmingly on Thursday to recognise Palestine as a state, in the face of opposition from Israel and the US.

The 193-member assembly voted 138 in favour of the plan, with only nine against and 41 abstentions. The scale of the defeat represented a strong and public repudiation for Israel and the US, who find themselves out of step with the rest of the world.

Thursday's vote marked a diplomatic breakthrough for Palestinian president Mahmoud Abbas and could help his standing after weeks in which he has been sidelined by Palestinian rivals Hamas in the Gaza conflict.

Abbas, who flew from Ramallah, on the West Bank, to New York to address the general assembly, said: "The moment has arrived for the world to say clearly: enough of aggression, settlements and occupation."

A Palestinian flag was unfurled on the floor of the general assembly after the vote.

Several hundred people turned out in Yasser Arafat square in Ramallah on the West Bank, waving flags and singing along to nationalist music to mark the occasion.

In his address, Abbas noted the symbolism of the date, the 65th anniversary of the UN partitioning what had been British-ruled Palestine into Jewish and Arab countries. In the decades that followed, the idea of an independent Palestine had often been in danger of disappearing but had been "miraculously" kept alive, he said.

The general assembly resolution had finally given legitimacy to Palestine, he said. "The general assembly is called upon today to issue a birth certificate of the reality of the state of Palestine."

Israel and the US immediately condemned the resolution. The office of the Israeli prime minister, Binyamin Netanyahu, described Abbas's speech as incitement and full of lies about Israel.

Ron Prosor, Israel's ambassador to the United Nations, said: "Because this resolution is so one-sided, it doesn't advance peace, it pushes it backwards."

The only way to a Palestinian state was through direct negotiations, he said.

Hillary Clinton, the US secretary of state, described the vote as "unfortunate and counterproductive". She said: "Only through direct negotiations between the parties can the Palestinians and Israelis achieve the peace that both deserve: two states for two people, with a sovereign, viable and independent Palestine living side-by-side in peace and security with a Jewish and democratic Israel."

Thursday's resolution raises Palestine from being a "non-member observer entity" to a "non-member observer state". The key is the final word, which confers UN legitimacy on Palestinian statehood and, while it cannot vote at the general assembly, it will enjoy other benefits, such as the chance to join international bodies such as the International Criminal Court (ICC).

While important, the resolution is limited, elevating Palestine only to the status of the Vatican, which until Thursday had been the only other non-member observer state. For Palestinians, the idea of an independent state bears little reality on the ground, given the degree of Israeli involvement in the West Bank and Gaza.

The US ambassador to the UN, Susan Rice, speaking after the vote, disputed that the resolution conferred statehood on Palestine. "Today's grand announcements will soon fade and the Palestinians will wake up to realise that little in their lives has changed," Rice said. "This resolution does not establish Palestine as a state."

But the coalition against the vote was thin. Apart from Israel and the US, those voting against were Canada, the Czech Republic, the Marshall Islands, Micronesia, Nauru, Palau and Panama.

European countries such as France, Italy, Spain, Norway, Denmark and Switzerland all voted yes. Britain and Germany both abstained, with Britain saying Abbas had failed to promise he would resume peace negotiations with Israel.

Some countries, especially in Europe, switched from abstention to support out of a feeling that Abbas needed to be bolstered after eight days of conflict between the Israelis and Palestinians earlier this month. An estimated 158 Palestinians died in Gaza, and six Israelis were killed.

The Israeli and US governments had put pressure on the Palestinians not to press the issue to a vote and threatened significant retaliation – mainly in the form of punitive financial measures. They have since largely backtracked over the threats, concerned that withdrawal of major funding might undermine Abbas at a time when he is particularly vulnerable.

The prospect of the Palestinians applying to bodies such as the ICC is one of the main reasons for Israeli opposition, fearful that the Palestinians might try to launch a case over Jewish settlements on the West Bank or over military attacks on the West Bank and Gaza.

Palestinian officials say they have no immediate plans to do so but it remains a new and useful lever for the future.

The Obama administration, in an effort to try to persuade the Palestinians to drop the vote, sent deputy secretary of state Bill Burns to see Abbas on Wednesday. But Abbas turned down his pleas.

The US, Israel and Britain wanted the Palestinians to give explicit pledges they would not seek to join the ICC any time soon and also to resume peace negotiations with the Israelis that were abandoned in 2010 over a settlement expansion.

In Ramallah, hundreds watching on a television in the square cheered enthusiastically for Abbas as he denounced Israel's most recent assault on Gaza.

When the Israeli ambassador began addressing the UN, the crowd in the square watching on a giant television screen began booing. Prosor's speech was suddenly cut, and nationalist music fired up.

But the mood of the crowd did not appear to be that of people who thought they were marking a great national moment, or who had hope that the general assembly's recognition of Palestinian statehood amounted to anything like the birth of a real country.