At least seven people have been injured in the Gaza Strip in a fresh wave of violence between armed militia groups and the Palestinian security forces.
The Erez clash came hours before Mahmoud Abbas was due to cross
Gunmen stormed the main government compound in Gaza, opening fire randomly in the air and battling police.
A gun battle broke out when gunmen blocked a main road and attacked a convoy going to meet the police chief.
Members of an armed affiliate of the mainstream Fatah party, which lost recent polls, are protesting over jobs.
There were at least five attempts by members of the al-Aqsa Martyrs Brigades to disrupt government activities on Monday - a day after the victorious Islamist group Hamas named its new cabinet.
The most serious was when about 30 militants charged the foreign and finance ministries and exchanged fire with security forces.
Two gunmen and two security officials were wounded - one of them hit by stray bullets in the legs as other employees ran for cover.
An Associated Press correspondent who was in the foreign ministry building reported that police stormed the building and searched room to room for the gunmen.
Three al-Aqsa members were eventually arrested, he reported.
In a separate development, trucks laden with flour and other goods entered the Gaza Strip from Israel, after the Israelis briefly re-opened their main cargo crossing into the Palestinian territory at Karni.
Karni crossing is meant to be the main conduit of goods to and from Gaza
This followed an agreement between the two sides late on Sunday at talks at the Tel Aviv home of the American ambassador to Israel Richard Jones.
But within an hour, the Israelis again ordered the Karni crossing closed, saying they had security concerns.
Palestinian officials complained that this breached the agreement for daily openings of eight hours. Last week there were reports of serious shortages of bread and other staples in Gaza after weeks of sporadic border closures by the Israelis.
An Israeli government spokesman said a separate crossing at Karem Shalom was also going to be allowed to open temporarily to allow trucks from Egypt to cross into Gaza.
Earlier, gunmen had briefly taken over Gaza's power plant and tried to seize control of a military hospital. No-one was injured.
But two officers and a gunman were hurt during the clash on the main road near the Erez crossing between Israel and the Gaza Strip.
A convoy of official vehicles had been going to pick up Palestinian police chief Alaa Hosni, who was travelling to Gaza from the West Bank.
About 30 gunmen had blocked the road to demand the authorities give them jobs in the Palestinian security services, reports say.
Palestinian Authority President Mahmoud Abbas was scheduled to use the road later on Monday to return to Ramallah. Erez is on the only direct route between the West Bank and Gaza Strip which crosses Israeli territory.
Gunmen also briefly shot at Gaza's main police station. Guards returned fire but there were no casualties.
BBC correspondent Alan Johnston says brief, violent protests like this have become quite common in Gaza and are a reflection of a chronic lack of law and order and how desperate some are becoming as poverty deepens.