Minutes before the truce began at 8 a.m. (0500 GMT), 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 withdrew from the Gaza Strip ahead of the truce, with a military spokesman saying their main goal of destroying cross-border infiltration tunnels 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", spokesman Lieutenant-Colonel Peter Lerner said, reflecting Israeli readiness to resume fighting if attacked.
Sami Abu Zuhri, a spokesman for the Islamist Hamas faction that rules Gaza, said Israel's offensive in the densely populated, coastal enclave was a "100 percent failure".
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 U.N. 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."
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,865 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.
Israel was expected to send delegates to join talks in Cairo to cement a longer-term deal during the course of the truce.
For now, Strategic Affairs Minister Yuval Steinitz told Israel's Army Radio, "there are no agreements. As we have already said, quiet will be answered with quiet."
Hamas said it had also informed Egypt "of its acceptance of a 72-hour period of calm", beginning on Tuesday.
The U.S. State Department welcomed the truce and urged the parties to "respect it completely". Spokeswoman Jen Psaki added that 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 key 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.
"Today we completed the removal of this threat," he said.
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.
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.