Masked gunmen killed 16 Egyptian soldiers at a checkpoint along the border with Gaza and Israel, the first such attack on troops.
The attackers then drove off into Israel, officials said.
Egypt blamed Islamist militants from Gaza and Egypt's troubled Sinai Peninsula for yesterday's attack and President Mohammed Morsi said they "will pay dearly".
The Israeli military said the attack was part of a plot to kidnap an Israeli soldier, and two vehicles commandeered by the attackers crashed into Israel, where one blew up.
In a statement, Israel's defence minister Ehud Barak said Israel's military and the internal security agency "thwarted an attack that could have injured many. The militants' attack methods again raise the need for determined Egyptian action to enforce security and prevent terror in the Sinai".
The attack took place around sunset in the Egyptian border town of Rafah, when the troops were having the traditional meal at the end of the daily fast during the Islamic holy month of Ramadan.
Egyptian state TV said the attack on the checkpoint was carried out by Islamist militants. The report said 16 troops were killed in the attack co-ordinated between Palestinians who entered Egypt from Gaza and Egyptians in Sinai.
Emergency services official Ahmed el-Ansari told Egypt's news agency that seven were wounded by gunfire.
President Morsi convened an emergency meeting with military and security leaders following the attack. In a statement, he declared: "Those who carried out this crime will pay dearly."
In an interview on Egyptian state TV early today Mr Morsi said: "There is no room for appeasing this treason, this aggression and criminality. The troops will totally control Sinai."
The head of the border guards, a paramilitary force under the command of Egypt's Defence Ministry, went to the scene of the attack, the TV said.
Mr Morsi's Muslim Brotherhood party urged Egyptian authorities to take all necessary measures to "confront this serious challenge to the Egyptian sovereignty and to protect Sinai from all armed groups".
It was one of the bloodiest attacks in Sinai in years and the deadliest against Egyptian troops, underlining the growing lawlessness of the Egyptian territory, where security forces have become targets of militants, some loosely linked with al Qaida.
Israeli military spokeswoman Lt Col Avital Leibovich said one vehicle exploded and Israeli aircraft struck the second one.
Israeli government spokesman Ofir Gendelman said on his Twitter account that seven militants were killed, four on the Israeli side and three in Egypt.
An Egyptian military official said Egyptian troops were pursuing the militants who returned to Egypt. He said the attackers used three vehicles.
An Egyptian border official said the Rafah terminal between Egypt and Gaza had been closed indefinitely. It is the only crossing from Gaza that is not under direct Israeli control.
A former Egyptian intelligence officer close to the military, Sameh Seif el-Yazel, told state TV the attack began at another checkpoint inside Rafah, where the militants took the armoured vehicles and headed toward the border checkpoint.
He said the militants drove about 25 meters into Israel before Israeli troops attacked them. Some fled back into Egypt, he said.
Egyptian and Israeli officials have been warning of a deteriorating security situation in Sinai, where militants have taken advantage of a security vacuum in the area following the uprising that toppled long-time president Hosni Mubarak last year.
In a statement posted on the website of Gaza's Hamas leaders, Hamas condemned "the ugly crime committed today against the Egyptian soldiers, and sent its condolences to the families of the victims, to Egypt's president and to his government". Hamas did not apportion blame for the attack.
The attack caused confusion among the security agencies because of its surprise nature. It took place at a checkpoint near the border where Israel, Gaza and Egypt meet.
Late last week Israel issued one of its frequent warnings to Israelis to leave the Sinai.
Since Mubarak stepped down, Israel has allowed Egypt to send in more troops to Sinai, which has been mostly demilitarised according to the 1979 peace deal between the two countries. Yesterday's attack spurred renewed calls in Egypt to amend the treaty to allow for more troops in Sinai.
A similar attack took place last year, when Palestinian militants crossed from Gaza into Egypt's Sinai Peninsula, made their way along the Israel-Egypt border, crossed back into Israel, attacked Israeli vehicles and killed eight people on August 18 last year. Israeli forces killed six Egyptians soldiers as they chased the militants, increasing tension between the two countries.
Relations between the two nations have always been cool. Since Mubarak was overthrown and Islamist parties moved to the front of the Egyptian political scene, Israeli officials have expressed concern about the possibility of deterioration in relations, while insisting that maintaining the peace treaty is in the interest of both countries.
Israel's military spokesman said intelligence services had reports of an impending attack from Egypt and were ready to thwart it.
Brig Gen Yoav Mordechai said militants blew up one of the vehicles to enter Israel. But he said Israeli intelligence services had information about an impending infiltration and sent aircraft to strike a second car the militants had seized from the Egyptian forces.
He told Army Radio, "We were prepared for it, therefore there was a hit."
- More about:
- Defence Policy
- Gaza Strip
- Hosni Mubarak
- Israeli Defense Forces
- Middle East