Israel and Palestinian militants agreed to a Egyptian-mediated truce that took effect late on Sunday.