The incident took place in al-Aghwar district near the northern town of Waqqas on Monday.
"A border patrol intercepted three armed men at 6am who tried to enter into Israel from the Wakkas region in northern Jordan and ordered them to surrender but they shot at the troops who returned fire, killing two," Asma Khidr said.
"A third suspect was arrested," she told reporters.
Khidr said the gunmen tried to evade the border patrol and hide in farms before opening fire on the soldiers, triggering a gunbattle that lasted more than four hours.
The incident occurred near a Jordanian-Israeli border post, she said, adding that an investigation was underway to determine if the suspects were Jordanians or other nationals.
Earlier on Monday, the Israeli army said a soldier had been wounded near the border between Israel and the West Bank by gunfire coming from Jordan.
Jordan, which signed a peace treaty with Israel in 1994, says it has foiled several attempts to infiltrate fighters or smuggle arms into the territories since the Palestinian uprising broke out in September 2000.