Saudi security officials said four of their men died in the assault. Security forces killed three attackers and wounded two, who were then captured, the Interior Ministry said.
It said members of the "deviant" group - which is what the government calls al Qaeda - threw explosives at the consulate gate and entered the compound in central Jeddah.
Some of the eight consulate staff wounded in the attack told Reuters that militants had tried to use them as human shields during a firefight with security forces.
"They held us hostage for an hour, an hour and a half. We were in two groups of about 4 and 8," said Muaffa Jilan Ibrahim, a Yemeni maintenance worker who had superficial bullet wounds.
"They told the security forces in front of us: 'We have hostages. If you approach, we will shoot'. They put us in front of them as human shields. The security forces stormed in and there was an exchange of fire," he said. A US State Department official had earlier denied any hostages were taken.
Another consular employee, Indian national Richard Simon, whose head was grazed by a bullet, said he counted five gunmen.
He said he had taken refuge in the consulate's emergency "safe haven", which also came under attack.
"Afterwards three guys fired on the door, came inside and took four of us to another area and told us to sit down.
"Then some military people came, both sides were firing and we were in between. We were all on the ground and some people were injured," he said from his bed at King Fahd hospital.
'TERRORISTS ON THE MOVE': US President George W. Bush said the attack showed "the terrorists are still on the move" and linked them to insurgents in Iraq, where violence threatens elections set for January.
"They want us to leave Saudi Arabia, they want us to leave Iraq, they want us to grow timid and weary in the face of their willingness to kill randomly, kill innocent people," Bush said.
US embassy spokeswoman Carol Kalin said five local staff, including a guard, were killed. She withheld their nationalities but security sources said they were Arabs and Asians.
Witnesses said the militants had hauled down the US flag and burned it after bursting into the mission.
A Saudi security official said the militants entered the compound through a side door where mail is delivered, but the US official said at least some had used the main entrance.
In the kingdom's last big attack, militants struck at oil companies and a housing compound in the eastern city of Khobar in May. At least 22 foreigners and seven security men died.
Gunmen have killed several foreigners since then, while Saudi forces have killed or captured some leading militants.
The Saudi government condemned the Jeddah attack and vowed to "hunt down terrorists until we...cleanse society of them".
"It shows that despite Saudi claims to the contrary, al Qaeda can still mount operations in the country," said Simon Henderson, a British consultant on Saudi Arabia.
"Worryingly there remain concerns not only about the effectiveness of Saudi security forces but also about their loyalty," Henderson told Reuters in London.