A ceasefire is believed to end five days of fighting between Israel and Palestinian Islamic Jihad (PIJ) fighters in Gaza.
It got off to a shaky start as both sides exchanged fire for two hours after the ceasefire began on Saturday evening.
At least 33 Palestinians have been killed since Tuesday in Gaza, where Israel says the PIJ attacked targets.
An Israeli and a Palestinian working in the country were killed in a Palestinian rocket attack on Israel.
Egypt led the mediation efforts, which urged both sides to abide by the ceasefire agreement.
Washington welcomed the cease-fire announcement, saying US officials worked with regional partners to pass the resolution.
A barrage of Palestinian rockets set off warning sirens in southern Israel, near Gaza, and in the suburbs of Tel Aviv, shortly before the ceasefire took effect at 22:00 local time (19:00 GMT) on Saturday.
Minutes after it reportedly began, militants fired more rockets at southern Israeli communities and the Israeli military launched airstrikes on what it said were two PIJ rocket launchers in Gaza.
At 23:00 a further rocket attack drew another round of airstrikes.
Despite the fighting, Israeli Prime Minister Benjamin Netanyahu’s office issued a statement confirming a ceasefire had been agreed and thanking Egypt for its “intense efforts” to preserve it.
It said Israel’s acceptance of it meant that Israel “made it clear that the peace will be met with peace and that if Israel is attacked or threatened, it will continue to do whatever is necessary to defend itself.”
The PIJ confirmed the ceasefire, with a spokesman telling Reuters news agency: “We will abide by it as long as the occupation remains. [Israel] adheres to it.”
According to a text from Egyptian intelligence seen by the BBC, Palestinian militants and Israel agreed to end operations targeting civilians and other individuals.
The BBC’s Yolande Gnell in Jerusalem said the words appeared to cover both the recent spate of rocket fire from Gaza and Israel’s controversial policy of targeting and killing militant leaders.
Israel launched its military operation in Gaza before dawn on Tuesday, killing three leaders of the PIJ in their homes, as well as at least 10 civilians, including the men’s relatives and neighbors.
PIJ fighters fired barrages of rockets into southern and central Israel, which they said were aimed at avenging the dead.
According to the Israeli military, at least 1,234 rockets and mortars were fired from Gaza in total, and 976 entered Israeli territory. Most were intercepted or landed in open areas, but some hit houses and other buildings.
A woman was killed when a rocket hit an apartment building in the central city of Rehovot on Thursday, while a worker from Gaza was killed after being hit by rocket fragments at a construction site in the southern Sdot Negev region.
The military says 221 rockets fell into Gaza, killing four people, including three children. Islamic Jihad denies this allegation.
Israel carried out airstrikes on 371 PIJ targets across Gaza, killing three leaders and destroying what it said were the group’s rocket launch sites and command centers.
Half of the 33 people killed in Gaza were civilians, including seven children and four women, local health officials said.