The detention followed a manhunt that was launched shortly after the attack late on Friday.
Israeli soldiers, special forces and border police took part in the detention and seizure of weapons from the two suspects, who it said were seized in the village of Qarawat Bani Hassan.
The fresh attack, combined with the death of a Palestinian man elsewhere in the occupied West Bank, could further fuel tensions that have soared over the past two months.
A string of Palestinian attacks in Israel and the West Bank have left 15 Israelis dead while at least 27 Palestinians have been killed by Israeli security forces in recent weeks.
The security guard was shot outside Ariel, a major settlement in the northern West Bank, late on Friday night by a pair of assailants in a car, the army said.
It said the guard stood in front of another guard who was with him, saving her life.
Israeli Prime Minister Naftali Bennett expressed condolences to the family of the security guard.
In a statement after the arrest of the suspects, he said "no terrorist can evade us".
In Gaza, the leader of the territory's Hamas rulers Yehiyeh Sinwar called for stepping up attacks against Israeli targets in the West Bank, saying the "real battle arena is there".
In a speech, he saluted the attackers who killed the guard.
Israeli forces on Saturday set up checkpoints and were conducting searches for the attackers in the area, the army said.
It said it arrested two purported members of the Hamas militant group but there was no immediate indication that the men were involved in the attack.
Hamas praised the killing of the guard but stopped short of claiming responsibility for the shooting.
In a separate incident, Israeli troops shot and killed a 27-year-old Palestinian man in Azoun village near the town of Qalqilya early on Saturday, the Palestinian Health Ministry said.
The army said it had opened fire after a group of suspects threw firebombs toward the soldiers.