Egyptian forces have struck "terrorist training camps" in retaliation for an attack on Coptic Christians, President Abdul Fattah al-Sisi has said.
State media say six strikes hit the town of Derna in neighbouring Libya.
Gunmen earlier attacked a bus carrying worshippers in central Egypt, killing at least 28 people and wounding 25 others.
President Sisi said he would "not hesitate to strike terrorist camps anywhere".
Announcing the strike in a TV speech late on Friday, he promised to "protect our people from the evil".
Countries supporting terrorism should be punished, he said, as he appealed to US President Donald Trump for help.
Military sources told Reuters news agency that the militants targeted in Libya had been involved in the attack on Egyptian Christians earlier in the day.
Although no group immediately said it was behind the attack, Islamic State (IS) militants have targeted Copts several times in recent months.
Libya is effectively controlled by a large number of armed militias that have emerged in the chaos since Nato-backed forces overthrew long-serving ruler Col Muammar Gaddafi in October 2011.
But IS has also built a presence in Libya during the chaos.
Egypt has launched air strikes against IS in Libya before. In 2015, the military bombed several sites, also near Derna, after militants released a video showing the beheading of 21 Egyptian Christians.
The Copts killed on Friday had been travelling to the Monastery of St Samuel the Confessor, 135km south of Cairo, from Minya province when their bus came under fire.
It was in a small convoy that was stopped on a desert road near Adwa police station on the border between Minya and Beni Suef provinces.
Between eight and 10 gunmen wearing military uniforms attacked the convoy, officials cited witnesses as saying. The gunmen then fired at the vehicles with automatic weapons before fleeing in three 4x4 vehicles, they added.
Minya Province Bishop Makarios said many of the victims were shot at point blank range, the New York Times reported.
He said that children had been on the bus and were among the dead, adding that a pick-up truck in the convoy carrying workmen at the monastery was also targeted.
Minutes after President Sisi's speech, the White House released a statement of support from Mr Trump.
"This merciless slaughter of Christians in Egypt tears at our hearts and grieves our souls," he said.
"America stands with President Sisi and all the Egyptian people today, and always, as we fight to defeat this common enemy," he added.
Copts make up about 10 percent of Egypt's population of 92 million.
What is the Coptic Christian faith?
The Coptic Orthodox Church is the main Christian Church in Egypt. While most Copts live in Egypt, the Church has about a million members outside the country.
Copts believe that their Church dates back to about 50 AD, when the Apostle Mark is said to have visited Egypt. The head of the Church is called the Pope and is considered to be the successor of St Mark.
This makes it one of the earliest Christian groups outside the Holy Land.
The Church separated from other Christian denominations at the Council of Chalcedon (451 AD) in a dispute over the human and divine nature of Jesus Christ.
- BBC / Reuters