Egyptian forces have struck “terrorist training camp” in retaliation for an attack on Coptic Christians.
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 Abdul Fattah al-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”.
Appeal for help
“Countries supporting terrorism should be punished,” he said, as he appealed to US President Donald Trump for help.
Military said 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.
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.