The truce was announced by Egyptian Foreign Minister Mohammed Kamel Amr following a day which had seen a devastating bus bombing attack near Isreal’s military headquarters.
Fears the peace process was hanging by a thread had mounted following the bus explosion in Tel Aviv, which left at least 27 people injured, and Prime Minister David Cameron had conceded in the Commons that confidence in achieving a solution were “dwindling”.
But Israeli Prime Minister Benjamin Netanyahu confirmed a peace deal had been reached, saying he had agreed after consulting with US President Barack Obama.
Both sides have promised to halt attacks on each other and ease an Israeli blockade constricting the Gaza Strip.
The deal was brokered by the new Islamist government of Egypt, who will play a key role in maintaining the peace under the agreement.
Minutes before the deal took effect at 9pm local time, there was a final flurry of Palestinian rocket attacks and Israeli airstrikes, including one that killed a man minutes before the deadline.
The attacks stopped after 9pm.
Mr Netanyahu said he had also reached an agreement with President Obama to work together against weapon-smuggling into Gaza. He added: “I know there are citizens that expected a wider military operation and it could be that it will be needed. But at this time, the right thing for the state of Israel is to take this opportunity to reach a lasting ceasefire.”
According to the agreement, Israel and all Palestinian militant groups agreed to halt “all hostilities”. Gaza’s border crossings with Israel would be opened further to allow freer movement of goods and people following 24 hours of quiet.
Hamas officials said details of the new border arrangements would have to be negotiated.
Israel imposed its blockade of Gaza after Hamas, a militant group sworn to Israel’s destruction, seized control of the territory five years ago.
The agreement said: “Each party shall commit itself not to perform any acts that would break this understanding. In case of any observations, Egypt – as the sponsor of this understanding – shall be informed to follow up.”
The deal marked a key victory for Egypt’s new Islamist government, which is caught in a balancing act between its allegiance to Hamas and its need to maintain good relations with Israel and the US. Hamas is an offshoot of Egypt’s ruling Muslim Brotherhood.
After the ceasefire was announced, the UN Security Council suspended a formal open debate.
Israel has launched over 1,500 airstrikes and other attacks on targets in Gaza since fighting started last Wednesday. More than 1,000 rockets have been fired at Israel.
In all, 161 Palestinians, including dozens of civilians, were killed, while five Israelis died.
Yesterday’s explosion in Tel Aviv was the first in the city since 2006.
Israel’s minister of internal security Yitzhak Aharonovich said the explosion was from a device placed inside the bus by a man who then got off.
While Hamas did not take responsibility for the attack, it had praised the bombing.