Egyptian security forces killed 12 Mexicans and Egyptians and injured 10 "by accident" on Monday, mistaking a tourist convoy for militants they were chasing in the country's western desert, the ministry of interior said.
At least two Mexicans were killed, Mexico's foreign ministry said in a statement.
A joint force from the Egyptian police and military was chasing militants in the country's vast western desert, which borders Libya, when it inadvertently opened fire on the convoy.
The convoy was made up of four four-wheel drive vehicles, the Egyptian interior ministry said in a statement, and there will be an investigation into how and why the tourists entered an off-limits area.
Mexican President Enrique Pena Nieto condemned the attack on his Twitter account, describing it as a tragic incident and demanding a full investigation.
"Mexico condemns these deeds against our citizens and has demanded an exhaustive investigation of what has occurred," he tweeted.
Egypt's tourism ministry spokesman told state news agency MENA the convoy was at an off-limits site and was using unlicensed cars. The convoy was taking part in an unapproved safari, he said.
Mexican ambassador Jorge Alvarez met with five Mexicans who were in stable condition in hospital, Mexico's foreign ministry said.
The Mexican ministry said an "undetermined" number of its country's nationals had been attacked and that it was in the process of identifying the two who had been killed.
Egypt is battling an insurgency that gained pace after the military ousted Islamist President Mohamed Mursi of the Muslim Brotherhood in mid-2013 after mass protests against his rule.
The insurgency, mounted by Islamic State's Egyptian affiliate, has killed hundreds of soldiers and police and has started to attack Western targets.
Earlier on Sunday Islamic State released a statement carried by its supporters on Twitter saying it had repelled an attack by the Egyptian military in the western desert.
While the insurgency has been largely based in the Sinai Peninsula, attacks have taken place in Cairo and other cities. In August, an Egyptian military aircraft crashed in the western desert near the Libyan border while on a mission against Islamist militants, killing four people.
Security officials say militants operating from Libya to the west of Egypt have been trying to forge ties with Islamists in the Sinai on the east side of the country.
Egyptian jets bombed Islamic State targets in Libya in February, a day after the group there released a video showing the beheading of 21 Egyptian Christians, drawing Cairo directly into factional conflict across its border.