The attack in the city of Petah Tikva, outside Tel Aviv, was carried out by a Palestinian assailant, police said, calling it a "terrorist" attack.
Police said initial indications were the attacker, 19, was from the Nablus governorate in the north of the occupied West Bank.
The man was arrested uninjured while still carrying the gun, they added.
The wounded were taken to hospital, with none of their injuries described as life threatening.
The United Hatzalah medical group said one man was beaten by the crowd who had apparently mistaken him for the attacker.
Most of the Palestinians killed were carrying out knife, gun or car-ramming attacks, according to Israeli authorities, with others were killed during protests, in clashes or Israeli air raids on Gaza.
The rate of attacks has declined significantly in recent months.