Attackers inside Egypt fired an anti-tank missile and automatic rifles at a military vehicle in Israel, wounding two soldiers in a rare cross-border incident, the military said.
The attack occurred in southern Negev Desert on Wednesday and the soldiers were evacuated to a hospital in Israel, it added.
An Egyptian security official suggested the gunfire came from smugglers who were clashing with Egyptian troops at the time along the border with Israel.
The frontier between Israel and Egypt is normally quiet. The two countries signed a peace accord 35 years ago and have close security cooperation.
No one immediately claimed responsibility for Wednesday's attack but armed groups in Egypt's Sinai Peninsula have attempted to carry out attacks against Israel in recent years.
In September 2012, an Israeli soldier was killed in a similar shooting. A year earlier, a series of coordinated attacks killed seven Israelis.
Al-Qaeda-linked fighters in Sinai have also carried out deadly attacks against the Egyptian military, which has been trying to crack down on their activity in the desert.
The Israeli military said it has no indication yet who was behind the attack. It said that it dispatched troops to the area to make sure that no infiltration into its territory took place.
In the meantime, it asked residents in the area to remain in their homes.
It later said after an investigation that troops had foiled a "violent drug smuggling attempt" and that the soldiers came under attack from three different points including from a car driving near the border.
It said the soldiers returned fire, killing at least three of the attackers.
Israeli media said the two - a female officer and a male soldier - were moderately wounded.
The Egyptian security official said the attack on the Israeli convoy came during an exchange of fire between Egyptian troops engaging smugglers in the area while an Israeli convoy was driving by.
The official said the Egyptian troops fired at the smugglers approaching the border and suggested the fire on the Israeli troops came from the smugglers.
The area is known to be an operation area for smugglers, but not considered an area where fighters have access, he added.
Security and medical officials said after Egyptian forces combed the area following the exchange of fire, they retrieved three bodies, and two seriously injured.
One of the dead is a Bedouin, identified as a 31-year old from a local tribe, the Tarabeen.
The Egyptian officials spoke on condition of anonymity because they were not authorised to speak to reporters.