The Palestinian Hamas group says a rival faction has tried to assassinate Prime Minister Ismail Haniya as he crossed back into Gaza from Egypt.
A bodyguard was killed and Mr Haniya's son was shot in the face as the fire fight erupted at the Rafah checkpoint.
Mr Haniya's convoy was returning after being held for hours following a dispute with Israel over millions of dollars in donations he was carrying.
His Hamas group is in conflict with President Mahmoud Abbas's Fatah group.
Israel had closed the Gaza border on Thursday, saying the tens of millions Mr Haniya was carrying as he returned from his foreign trip would fund "terrorist operations".
Mr Haniya crossed late in the evening following hours of intense negotiations, leaving the reported $30m (£15.3m) on the Egyptian side with his aides.
But at the border, guards allied to Fatah exchanged fire with Mr Haniya's security forces.
The BBC's Alan Johnston in Gaza said that during chaotic scenes gunfire rattled around the entrance hall to the customs hall as Mr Haniya's bodyguards shielded him.
Television pictures showed Mr Haniya's jeep manoeuvring to avoid bullets.
Mr Haniya's convoy had been at the border point for almost eight hours.
He had cut short his first trip abroad as prime minister to deal with mounting tensions between Hamas and Fatah.
Inter-faction tensions have increased since the killing of three sons of a pro-Fatah security chief on Monday.
Hamas militants take cover in the fire fight at the border
Hamas won elections in January, but has struggled in government amid a Western aid boycott against the militant Islamic group, which refuses to renounce violence and recognise Israel.
The Palestinian Authority has been unable to pay full salaries to its 165,000 workers.
Mr Abbas, president of the Palestinian Authority, has spoken of the possibility of fresh elections but our correspondent says Hamas would regard that as tantamount to a coup.
On Thursday Israeli Defence Minister Amir Peretz had ordered European Union monitors to close Rafah.
Angry Hamas militants then stormed the crossing and took it over from the Palestinian presidential guard.
Israel said Mr Haniya would only be allowed to return if he left the money on the Egyptian side.
There are reports that the money has been deposited in an Arab League bank account in Egypt, our correspondent says.