Benjamin Netanyahu was addressing a rally in Israel's Ashdod

Sirens warning of rocket fire from Gaza cut short an election rally by Israeli Prime Minister Benjamin Netanyahu in the southern city of Ashdod late Tuesday, public television reported.

KAN 11 broadcast footage of Netanyahu's security detail closing in around him as he was speaking from the podium.

One of them whispered in his ear before the premier raised a hand in farewell and was hustled from the building.

The army said in a statement that two rockets had been fired from the Hamas-run Gaza Strip at southern Israel but both had been shot down by Israel's Iron Dome missile defence system.

Sirens had sounded in Ashdod and also nearby Ashkelon, it said.

Video posted on WhatsApp by Netanyahu's Likud party showed him returning to the stage after the all-clear and saying that the Palestinian Islamist movement Hamas was scared of him wining the September 17 polls.

"If it attacks us on live TV, you understand that it doesn't want us here," he told his audience.

The incident came less than three hours after Netanyahu pledged to annex the Jordan Valley in the occupied West Bank if re-elected.

Also in Ashdod when the sirens sounded was Netanyahu's political rival, former defence minister Avigdor Lieberman, speaking to supporters of his nationalist Yisrael Beitenu party.

"Today's event proves that Netanyahu's policy of surrender to terror is bankrupt," he said in a statement on Facebook.

Lieberman resigned as defence minister in November over a Gaza ceasefire deal which he called a "capitulation to terror".