Israel and the Hamas militant group agreed to a cease-fire Wednesday to end eight days of the fiercest fighting in nearly four years, promising to halt attacks on each other and ease an Israeli blockade constricting the Gaza Strip.