Two Palestinians opened fire near an open-air market in central Tel Aviv on Wednesday night, killing four Israelis and wounding at least five others in one of the deadliest attacks in an eight-month wave of violence.

The shooting occurred at the Sarona market, a series of restored buildings that have been transformed into a popular tourist spot filled with crowded shops and restaurants. The complex is across the street from Israel's military headquarters and is often filled with tourists and young soldiers in uniform.

"Two terrorists opened fire at civilians," Tel Aviv district police commander Moshe Edri said, adding that one of the detained attackers was being treated for a gunfire wound.

Police had initially said there might be a third attacker but later ruled that out after extensive searches and examining security camera footage.

Tel Aviv's Ichilov Hospital said the four slain Israelis had been brought to the facility in critical condition and later died of their wounds.

Israeli forensic police inspect a restaurant following a shooting attack at a shopping complex in Tel Aviv. (Jack Guez/AFP/Getty Images)

Meital Sassi told Channel 10 TV she was out with her family celebrating her son's birthday at the Sarona market when she heard shots and "immediately understood it was a terror attack."

She said they ran with the baby and the stroller.

"I yelled at people who didn't understand what was happening to run."

Channel 10 aired CCTV footage from inside a restaurant showing two men in suits shooting at diners as they run away from their tables. One of the attackers shoots a man on the ground and waves a knife before running out.

Israeli security personnel searched the area. The death toll has risen to four, officials say. (Baz Ratner/Reuters)

Shlomi Hajaj, director of the market, told Channel 10 that security guards at the entrance prevented the attackers from entering, "averting a bigger disaster" as the market was packed with people.

Police said the two gunmen were members of the same family from the Palestinian village of Yatta, near the West Bank town of Hebron, which has been a flashpoint for violence in recent months.

Over the last eight months Palestinian stabbings, shootings and car ramming assaults have killed 31 Israelis and two Americans. About 200 Palestinians have been killed during that time, most identified as attackers by Israel. The assaults were once near-daily incidents but they have become less frequent in recent weeks.

People hug each other following the attack. The Sarona market is a popular destination for tourists. (Baz Ratner/Reuters)

Most of the attacks have been in East Jerusalem or the West Bank, territories Israel seized from Jordan in the 1967 war, which the Palestinians want for their future state.

But Tel Aviv, Israel's most cosmopolitan city, has not been spared.

A member of Israel's Arab minority went on a shooting rampage on New Year's Day, killing three people. And in March a Palestinian went on stabbing spree, killing an American and wounding seven other people before he was shot and killed.

Hamas, the Islamic militant group that rules Gaza, welcomed the attack but did not claim responsibility for it. Hamas official Mushir al-Masri called the shootings a "heroic operation." The group later issued an official statement promising the "Zionists" with more "surprises" in the Muslim holy month of Ramadan.

Prime Minister Benjamin Netanyahu met with his defence minister and security leaders shortly after the attack.

Canada condemned the attack.

Condemn violence and anyone who seeks to glorify <a href="https://twitter.com/hashtag/Sarona?src=hash">#Sarona</a> market terrorists. Appalling and unacceptable. <a href="https://t.co/nrXiWcQ2Ck">https://t.co/nrXiWcQ2Ck</a> —@MinCanadaFA

U.S. State Department spokesman Mark Toner condemned the "horrific terrorist attack" in a statement, saying "cowardly attacks against innocent civilians can never be justified."