TEL AVIV—A Palestinian gunman shot and killed two Israelis as he drove through the streets of Jerusalem, police said Sunday, in what Israeli authorities described as a terror attack.

Israeli police shot dead the 39-year-old assailant less than five minutes after the spree started, chasing him on motorcycles and engaging in a short gunbattle, police said. Two officers were wounded in the exchange of fire.

The assailant shot five Israelis, including the dead, before being stopped by police. Another two people were involved in a car accident in the midst of the rampage, Israel’s ambulance service said.

A 60-year-old woman and a 30-year old man were rushed to Hadassah hospital in Jerusalem and later died from their wounds, a hospital spokeswoman said. Several other Israelis had wounded limbs, the ambulance service added.

The attacker began his spree near a light rail station in the city’s north before moving to the neighborhood of Sheikh Jarrah in East Jerusalem, police said. He was a resident of East Jerusalem, the holy city’s predominantly Arab sector.