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 (85 miles) 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 a police station on the border with Beni Suef provinces.
Gunmen wearing military uniforms attacked the convoy with automatic weapons before fleeing in 4X4 vehicles, eyewitnesses said.
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% of Egypt's population of 92 million.
Two suicide bombings at Palm Sunday services at churches in the northern cities of Alexandria and Tanta on 9 April left 46 people dead.
Those attacks prompted President Sisi to declare a three-month nationwide state of emergency and promise to do whatever was necessary to confront jihadist militants, most of whom are based in northern Sinai.
But many Copts complain that the Egyptian authorities are not doing enough to protect them, says the BBC's Orla Guerin in Cairo.
There is now a real sense of fear, and a feeling of being hunted, she adds.