Israel and Palestinian armed groups led by Hamas completed a tense third exchange of captives for prisoners.