Cairo: Israel and Hamas agreed on a truce that will take effect on Wednesday night, ending a week of violence in and around the Gaza Strip that killed more than 150 people, Egypt and the United States said.
Egyptian Foreign Minister Mohammed Kamel Amr, speaking at a joint news conference in Cairo with US Secretary of State Hillary Clinton, said the cessation of hostilities would begin at 1900 GMT.
"The United States welcomes the agreement today for a ceasefire. In the days ahead, the United States will work with partners in the region to consolidate this progress," Clinton said.
Nearly 24 hours after a truce had been expected to take hold, Israeli Prime Minister Benjamin Netanyahu's office said he was prepared to give peace a chance.
"A short while ago Prime Minister Benjamin Netanyahu spoke with (US) President Barack Obama and agreed to his recommendation to give a chance to an Egyptian proposal for a ceasefire and thereby give an opportunity for the stabilisation of the situation and a calming of it," said a statement.
It won him praise from Obama.
"The president commended the prime minister for agreeing to the Egyptian ceasefire proposal, which the president recommended the prime minster do, while reiterating that Israel maintains the right to defend itself," the White House said.
In Cairo, Hamas chief Khaled Meshaal was due to give a news conference following the announcement, Hamas sources told AFP.
The agreement came after a day of shuttle diplomacy - led by Clinton and UN Secretary General Ban Ki-moon - which was marred by more deadly cross-border violence between Israel and militants in Gaza.
Hopes for a truce appeared to have been faint just hours earlier as a blast tore through a bus in Tel Aviv and Israel hit back with deadly air raids on Gaza City and elsewhere in the Palestinian territory.
The conflict had threatened to take a new turn on Wednesday when a bomb ripped through a commuter bus in Israel's commercial capital, injuring 17 people and sparking panic.
The blast occurred very close to the Israeli defence ministry and was quickly denounced by Netanyahu's spokesman, who tweeted: "This was a terrorist attack".
The windows of the bus were blown out and its seats contorted from the force of the explosion, in scenes reminiscent of the second Palestinian intifada.
"I am speechless. This is scary," said Sigalit, a 22-year-old waitress working nearby.
Condemnation poured in, with Washington branding it "outrageous," Moscow denouncing it as a "criminal," and France and Germany calling for an urgent and lasting ceasefire in Gaza.
Soon after, another six Palestinians were killed in air strikes on Gaza City, raising the day's toll to 11, Palestinian medics said.
One of the strikes hit the building housing AFP's offices, killing a toddler in a neighbouring building, a health ministry spokesman said. No AFP journalists were inside at the time.
The Israeli military had no immediate comment on the strike, the second to hit the building in 24 hours.
Another air strike shortly afterwards on central Gaza killed a four-year-old girl, medics said.
The chances of a ceasefire appeared dim only hours earlier, with UN chief Ban saying after talks in Egypt with President Mohamed Morsi that there were still "many details to work out".
"We all know there are many details to work out but while that happens, civilians continue to die and cities continue to be targeted. And that's why we need a ceasefire right now, immediately," he told reporters in Cairo.
Israel launched its offensive on November 14 with the targeted killing of a Hamas military chief. Since then, 148 Palestinians and five Israelis have been killed.
It came as Israel heads towards a general election in January, and raised the spectre of a broader military campaign along the lines of the Jewish state's devastating 22-day operation launched at the end of December 2008.