Israel and Hamas agreed to a cease-fire Thursday, halting a bruising 11-day war that caused widespread destruction in the Gaza Strip.