"Two policemen and two civilians who were in the area engaged the terrorist and killed him," Israel's police commissioner said.

The shooting followed a spate of attacks by Palestinians around Jerusalem and in the West Bank that have killed 13 Israelis and a Ukrainian woman since late January.

Over the past year, Israeli forces have made thousands of arrests in the West Bank and killed more than 200 Palestinians, including fighters and civilians. More than 40 Israelis have died in attacks by Palestinians over the same period.

"There has been another terror attack in the heart of Tel Aviv tonight," Netanyahu said after being updated on events during a visit to Italy.

"We strengthen the security forces and the police who are fighting terrorists this night and every night."

Israel's military later said it was operating in the West Bank town where the Hamas gunman lived.

West Bank gun battle

Earlier on Thursday, Israeli forces killed three gunmen from the militant Islamic Jihad group in a gun battle in the West Bank. Hamas said the Tel Aviv shooting was a response to that.

"The heroic operation is a natural response to the crimes conducted by the occupation," Hamas spokesperson Hazem Qassem said.

The three hurt in the Tel Aviv shooting were rushed to a hospital, one in serious condition.

US Ambassador to Israel Thomas Nides said on Twitter: "Shocked by tonight's brazen terrorist attack in Tel Aviv that targeted innocent people. Praying for those who were injured."

The attack came hours after US Defense Secretary Lloyd Austin ended a brief visit to Israel during which he called on all sides to de-escalate the violence.

After the shooting, Tel Aviv Mayor Ron Huldai asked protesters, who had been rallying against a planned judicial overhaul, to stay at home.