Israel has reopened its only border crossing with Gaza after reaching an agreement with its rulers, Hamas, to end two weeks of hostilities along the border.