Israel and Hamas agree to Gaza cease-fire