The Israeli military said its air defence system, known as Iron Dome, intercepted the rocket. There were no reports of casualties.
Israel's Haaretz daily published a video on its website showing Mr Netanyahu being taken to a shelter as he was campaigning hours before the primaries of his Likud party.
Mr Netanyahu says he knows how to protect Israel, but opponents accuse him of being soft on handling threats from Gaza.
A similar incident happened in September when Mr Netanyahu was in the nearby city of Ashdod.
He was campaigning then for the second general Israeli election of the year.
That was believed to have triggered Israel's targeted killing of a senior commander in the Palestinian Islamic Jihad group in November.
Israel and Gaza militants had their worst round of fighting in months as a result.
No Palestinian group claimed responsibility for Wednesday's attack.
Such sporadic launches of rockets and ensuing Israeli airstrikes have happened frequently despite an Egyptian-brokered ceasefire that ended two days of fighting in November.
Hamas, the larger Islamic movement controlling Gaza, seeks "understandings" with Israel to alleviate Gaza's economic and humanitarian crises.
The militant group stayed on the sidelines during the November flare-up.