Israel shares a 240-kilometre (150-mile) border with Egypt on the Sinai peninsula
An Israeli soldier and three militants who infiltrated from Egypt's Sinai Peninsula were killed in a clash along the border on Friday, the army said.
It said troops came under fire from gunmen who sneaked across the border, sparking a firefight which killed the three attackers.
An Israeli soldier was also killed and a second moderately injured, a military spokeswoman said, confirming a report from Egyptian security sources in the Sinai.
"I can confirm he is dead," she said, without confirming Egyptian reports that one of the attackers had blown himself up.
An Israeli military statement named the soldier as gunner Natanel Yahalomi, 20, and said he was "killed by terrorist gunfire." He was promoted posthumously to the rank of corporal.
Friday's deadly ambush was the latest in a string of attempts by militants to sneak across the border and attack Israelis, with an army spokeswoman saying that quick action by its troops had foiled "a very big terror attack."
The incident took place on the Israeli side of the frontier at a place called Har Harif which is almost half-way down Israel's 240-kilometre (150-mile) border with the Sinai.
"Three armed terrorists entered from the Sinai into Israel," army spokeswoman Lieutenant Colonel Avital Leibovich told reporters.
"They opened fire toward IDF (army) troops that were guarding the workers (building the border fence) in that area. Another force that was nearby... rushed to the area and targeted those three terrorists," she said.
"All three terrorists were killed."
She said the gunmen were "very well armed and prepared," and an army statement said they carried an AK-47 assault rifle, three rocket-propelled grenades (RPGs), a machinegun and an explosives belt.
"A very big terror attack was thwarted by the quick response of these soldiers," Leibovich said, ruling out the possibility that any other gunmen had infiltrated Israeli territory.
Egyptian security sources in Sinai said one of the attackers had died when he detonated an explosives belt he was wearing. Witnesses in the area said they heard an explosion followed by heavy gunfire.
In Israel, a spokeswoman for Soroka hospital in the southern city of Beersheva said doctors were treating an injured soldier who had been airlifted from the site of the attack.
"One soldier is in moderate to serious condition with a stomach injury," said spokeswoman Inbar Gutter.
Border security incidents have increased over the past 18 months as a wave of lawlessness has gripped the Sinai since the overthrow of veteran Egyptian president Hosni Mubarak.
On August 5, Islamist militants staged a bloody ambush on an Egyptian security post, killing 16 border police before crashing an armoured vehicle and a truck through the Israeli border fence where they were killed by troops.
At least three militants on June 18 sneaked across the border from Sinai and ambushed two cars carrying Israeli construction workers, killing one and sparking a firefight with the army in which two of the gunmen died. The third fled back to Egypt.
The most serious incident for the Jewish state took place in August 2011, when another group of gunmen from Sinai infiltrated southern Israel and staged a series of ambushes that killed eight Israelis.
Israel has accused Gaza-based militants of using the Sinai as a launchpad for cross-border attacks and has demanded that Egypt crack down on Islamist elements in the lawless peninsula.
In a bid to prevent such attacks, as well as the entry of illegal immigrants from Africa, Israel has been working on the construction of a massive steel barrier along its border with the Sinai.