CAIRO—Islamic State militants armed with guns and a vehicle bomb attacked Egyptian police forces in the Sinai Peninsula, killing at least 18 civilians and policemen, the interior ministry said, the deadliest assault in months in the restive region.

The roadside bomb blew up after intercepting a group of police vehicles west of the city of Al Arish, an interior ministry statement said, and an ensuing gunbattle erupted between security forces and the militants. The hourslong clash left three militants dead, according to state...