Minutes before the truce began at 8am, Hamas launched a salvo of rockets, calling them revenge for Israel's "massacres". Israel's anti-missile system shot down one rocket over Jerusalem, police said.
Another hit a house in a town near Bethlehem in the occupied West Bank. There were no casualties.
Israeli armour and infantry left Gaza ahead of the truce, with a military spokesperson saying their main goal of destroying cross-border infiltration tunnels dug by militants had been completed.
"Mission accomplished," the military tweeted.
Troops and tanks will be "redeployed in defensive positions outside the Gaza Strip and we will maintain those defensive positions", spokesperson Lieutenant-Colonel Peter Lerner said, reflecting Israeli readiness to resume fighting if attacked.
Sami Abu Zuhri, a spokesperson for the Hamas faction that rules Gaza, said Israel's offensive in the densely populated, coastal enclave was a "100 percent failure".
Israel sent officials to join talks in Cairo to cement a longer-term deal during the course of the truce. Hamas and Islamic Jihad also dispatched representatives from Gaza.
In Gaza, where some half-million people have been displaced by a month of bloodshed, some residents, carrying mattresses and with children in tow, left UN shelters to trek back to neighbourhoods where whole blocks have been destroyed by Israeli shelling and the smell of decomposing bodies fills the air.
Sitting on a pile of debris on the edge of the northern town of Beit Lahiya, Zuhair Hjaila, a 33-year-old father of four, said he had lost his house and his supermarket. "This is complete destruction," he said. "I never thought I would come back to find an earthquake zone."
Visiting International Red Cross President Peter Maurer, responding to local criticism that his organisation was late in helping some of the victims, said "we were insufficiently able to bridge the gap between our willingness to protect them and our ability to do so".
Truce attempts
Several previous truce attempts by Egypt and other regional powers, overseen by the United States and United Nations, failed to calm the worst Israeli-Palestinian fighting in two years.
An Israeli official said that in the hour before the ceasefire came into effect, the civilian airspace over Tel Aviv was closed as a precaution against Gaza rockets, and takeoffs and landings were delayed at Ben-Gurion Airport.
Gaza officials say the war has killed 1,867 Palestinians, most of them civilians. Israel says 64 of its soldiers and three civilians have been killed since fighting began on July 8, after a surge in Palestinian rocket launches.
Hamas said it had informed Egypt "of its acceptance of a 72-hour period of calm", beginning on Tuesday.
The Palestinian cabinet issued a statement after its weekly meeting in Ramallah welcoming the ceasefire. The US State Department also welcomed the truce and urged the parties to "respect it completely".
Spokesperson Jen Psaki said Washington would continue its efforts to help the sides achieve a "durable, sustainable solution for the long term". Efforts to turn the ceasefire into a lasting truce could prove difficult, with the sides far apart on their central demands, and each rejecting the other's legitimacy.
Hamas rejects Israel's existence, and vows to destroy it, while Israel denounces Hamas as a terrorist group and eschews any ties. Besides the truce, Palestinians demand an end to the Israeli-Egyptian blockade on impoverished Gaza and the release of prisoners including those Israel arrested in a June crackdown in the occupied West Bank after three Jewish seminary students were kidnapped and killed. Israel has resisted those demands in the past.
Palestinian Foreign Minister Riad al-Malki said there was "clear evidence" of war crimes by Israel during its offensive in Gaza as he met International Criminal Court prosecutors in The Hague on Tuesday to push for an investigation.
Both sides have traded allegations of war crimes during the Gaza assault, while defending their own actions as consistent with international law.
Israel: Demilitarise Gaza
Lerner said the army overnight destroyed the last of 32 tunnels located inside Gaza and which had been dug by Hamas for cross-border ambushes at an estimated cost of $100 million.
Israeli officials say, however, that some tunnels may have gone undetected and that the armed forces are poised to strike at these in the future. Israeli Prime Minister Benjamin Netanyahu also wants to disarm Hamas and demilitarise Gaza, after guerrillas launched more than 3,300 rockets and mortar bombs at Israel this past month. Hamas has ruled that out.
"For Israel the most important issue is the issue of demilitarisation. We must prevent Hamas from rearming, we must demilitarise the Gaza Strip," Netanyahu spokesman Mark Regev told Reuters television.
Since the fighting began, several previous truces barely held. Regev said Israel had accepted Egypt's terms weeks before Hamas, and expressed a wish that the truce would last: "I hope this time we see the ceasefire work that's good for everybody."
Egypt has positioned itself as a mediator in successive Gaza conflicts but, like Israel, its current administration views Hamas as a security threat. Besides the loss of life, the war has cost both sides economically.
Gaza faces a massive $6 billion price tag to rebuild devastated infrastructure. Israel has lost hundreds of millions of dollars in tourism, other industry, and fears cuts in overall economic growth this year as well.
Palestinian officials said a donor conference to raise funds for Gaza's reconstruction would be held in Oslo next month.
In London, a British minister, Sayeeda Warsi, resigned on Tuesday, saying she could not support government policy on the war. While his government has called for a ceasefire in Gaza, Prime Minister David Cameron has been criticised by the opposition for refusing to describe Israel's military actions in Gaza as disproportionate.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ