The incident was reported at the Bekaot checkpoint in the northern West Bank. The soldiers were not injured.
The two Palestinian men, aged 23 and 38, were reported to be from villages south of Jenin.
Tension between Palestinians and Israelis has risen in recent months with a series of violent incidents.
The Palestinian Wafa news agency named those killed as Ali Muhammad Aqqab Abu-Maryam and Said Judah Abu-al-Wafa and said they had been shot "in cold blood".
The Israel Defense Forces said the soldiers had "thwarted the attack and shot the assailants".
Relations between Israelis and Palestinians remain tense amid a wave of attacks on Israelis by Palestinians and some Israeli Arabs which have killed 22 Israelis since the beginning of October.
During that time 149 Palestinians - more than half said by Israel to be attackers - have been shot dead by security forces or their victims. Others have been killed in clashes with Israeli forces.
Overnight, Israeli forces demolished a home in the West Bank belonging to relatives of a Palestinian - Muhannad Halabi - shot dead in October after killing a rabbi in Jerusalem's Old City.
Israel says home demolitions, which have come under international criticism, are a way of discouraging Palestinian attacks.
On Friday, an Israeli Arab wanted for shooting dead three people in Tel Aviv on 1 January was killed by security forces in northern Israel.
Nashat Melhem was followed to a mosque in his home town of Arara and died in a gun battle, police said.
Police said Melhem, 29, was the gunman who killed two Israelis at a bar, then the Israeli Arab driver of a taxi who picked him up after the attack.
Melhem's father, Mohammed, had identified his son as the suspect and reported him to the police. Mohammed Melhem and several relatives have been arrested in connection with the case.
Police have not yet established a motive for the Tel Aviv killings.
Two Palestinians have been shot dead by Israeli soldiers after attempting to stab them at a checkpoint in the occupied West Bank, the military says.