The bodies of Muhammad Ismail and Nasr Abu Frayej were transported to the hospital immediately after the execution.
Eight additional Gazans have been sentenced to death on the same charges.
Over the past few weeks human rights groups urged Hamas to reverse the decision to execute the collaborators. The Islamist group published polls according to which the overwhelming majority of Palestinians support the execution of convicted collaborators.
The executions were carried out without the authorization of Palestinian President Mahmoud Abbas, as is required by Palestinian law. The rivalry between Hamas and Abbas' Fatah faction has reached a fever pitch and has often turned violent since Hamas took over Gaza in the summer of 2007.
In January 2009, during the IDF offensive, Hamas executed six Palestinians on suspicion of collaboration with Israel.
Amid the stalemate in the reconciliation talks between Hamas and Fatah, two of the rival groups' leaders met in Gaza on Monday.
Speaking to reporters after the meeting, Sufian Abu Zaida, a member of Fatah's Revolutionary Council, said the meeting with Hamas Interior Minister Fathi Hamad focused on the need to stop the mutual incitement between Hamas and Fatah in the media.
The leaders also discussed the persecution of Fatah figures who reside in Gaza and Hamas men who live in the West Bank.