Two of the injured are members of the Palestinian security services, while the other three are maintenance workers
It was not immediately known who attacked the building of the Fatah-dominated Preventive Security agency, which is loyal to Mahmoud Abbas, the Palestinian president.
Security personnel fired at the attackers, but the assailants escaped, officials said.
Hamas has accused the security agency of being behind a wave of unrest in Gaza which has resulted in the death of at least 16 people since early May.
Tuesday's attack came before Abbas announced that a referendum on a plan that recognises Israel would be delayed.
Yasser Abed Rabbo, an official close to Abbas, said: "Before the end of the week, President Abbas will hold a news conference to announce the holding of the referendum and the beginning of the process for carrying it out."
Hamas opposes the referendum.
One person was wounded when Palestinians fired three rockets into southern Israel, near the town of Sderot, Israeli military sources said.
Home-made Palestinian Qassam
rockets were fired into Sderot
Israel's new defence minister Amir Peretz said the army would continue to pursue those behind the rocket attacks.
"Our response will be hard and painful," Peretz told Israeli radio.
Shortly after the attacks, the Israeli army fired artillery shells towards the area of northern Gaza from where the rockets were believed to have been fired, military sources said.