The Saudi government has said little about how its security forces quelled the gunmen.
News agencies quote an official government statement as saying only that "the situation was brought under control."
An Interior Ministry official told reporters that there was heavy fighting and that at least seven people died.
The security forces say they killed three of the gunmen in gun battles and arrested two others. The security forces say four of their own members were killed.
During the day-long events, witnesses and security officials often told reporters that the gunmen were believed to be holding hostages -- by some estimates as many as 18.
No further details about the reported hostage taking have yet emerged. But one Interior Ministry official said no Americans were injured.
At the height of the crisis, reporters on the scene in Jeddah saw flames coming from the consulate building and hundreds of security forces surrounding the consulate compound. The Saudi forces sheltered behind cars, an indication that they feared sniper fire from the gunmen inside the building.
It is still too early to know what group launched the attack. But Saudi Arabia has been battling a wave of violence from Al-Qaeda and similar extremist Islamic militant groups over the past 18 months.
The violence - which began on large scale with suicide bombings in Riyadh that killed 35 people in May 2003 -- has targeted foreigners and security forces. Some 170 people, including foreigners, security forces, and militants have died in attacks and clashes since.
The Saudi government has sought to crack down on extremist groups. Crown Prince Abdallah bin Abd al-Aziz, the de-facto ruler, vowed no mercy after militants attacked oil company compounds in the western city of Khobar six months ago, killing 22 people.
"It's both in the interest of Saudis and the people who live in Saudi Arabia that these incidents don't happen," al-Aziz said. "Nobody with any relation to Islam or any humanity and dignity will give them any mercy at all."
The militant groups are seeking to drive Westerners from Saudi Arabia as part of a campaign to overthrow the Saudi royal family.
Groups such as Al-Qaeda accuse the ruling family of corruption and of defiling Saudi Arabia as the birthplace of Islam by allowing many non-Muslim Western technicians and businessmen to work in the country.
(RFE/RL/news agencies)Related stories:Pakistan's President Says Bin Laden Trail Has Gone Cold