The suspected gunman was killed by security forces after a manhunt, according to a statement from Israel’s General Security Service on Friday morning.
“At the end of a chase by the security forces, the terrorist carrying out the attack in Tel Aviv was located and thwarted,” the statement read.
The General Security Service said the suspect was shot and killed by Shabak security forces after an exchange of fire.
The suspect was “located by Shabak (General Security Service) while hiding near a mosque in Jaffa, and during a shootout with Shabak and YAMAM (Israel’s counterterror national unit) fighters, he was killed on the spot,” the statement said.
It identified the gunman as Raed Hazem, a 28-year-old from the West Bank Palestinian town of Jenin, who had “no clear organizational affiliation, no security background and no previous arrests.” The service said Hazem was not allowed to enter Israel and was staying illegally.
The investigation into the attack continues, according to the General Security Service.
The incident happened at a bar on Dizengoff Street, a popular dining area in the center of the city, an Israeli police chief said.
The number of wounded was not immediately clear. In a speech on Israeli television, Tel Aviv Police Chief Ami Eshed set the figure at more than a dozen.
Journalist Lauren Izso, at the scene shortly after the attack, estimated that hundreds of police were involved in securing the area and looking for the gunman.
Tel Aviv Mayor Ron Huldai spoke on Israeli television and asked residents of the city to stay home.
The two people killed were men who were both about 30 years old, a spokesman for the Magen David Adom emergency services said.
Tel Aviv’s Ichilov hospital, where most of the wounded were taken, said doctors were fighting to save the lives of four people who were injured.
The shooting is the latest in a series of violent incidents that have put Israel and the Palestinian territories on edge.
In just one week in March, 11 people were killed in three attacks on Israeli cities. It was the deadliest week Israel had seen in years, and follows weeks of rising tensions, with Israelis being stabbed and several Palestinians shot and killed by Israeli forces in the West Bank.
It is not clear if Thursday’s shooting is linked to the latest violence.
Militant groups in Gaza and the West Bank praised Thursday’s attacks, even though they stopped without taking responsibility.
Hamas called it a heroic operation, while Islamic Jihad promised that “resistance will continue.”
The United Nations’ special coordinator for the Middle East, Tor Wennesland, condemned the attack and highlighted Hamas in a tweet, saying: “Sorry for the welcome of this attack from Hamas; there is no honor in terror. These attacks must stop now and be condemned by all.”
CNN’s Abeer Salman, Ibrahim Dahman, Andrew Carey and Hadas Gold contributed to this report.