Several Americans were slightly injured, according to a State Department official in Washington.
President Bush speaking Monday in the Oval Office after meeting with Ghazi al-Yawer, the interim Iraqi president, said that the attack in Jiddah demonstrated that "terrorists are still on the move" trying to intimidate Americans and force the United States to withdraw from Saudi Arabia and Iraq.
"They want us to grow timid and weary in the face of their willingness to kill randomly, kill innocent people," the president said. "That's why these elections in Iraq are very important."
A U.S. Embassy spokeswoman says five consular staff were killed in the attack. Three attackers were among those killed, while two others were injured and arrested, the Saudi Interior Ministry announced. Saudi security officials also said four of their forces were killed, apparently in storming the compound after the initial attack.
The ministry statement didn't mention hostages. But a Saudi official, speaking from Riyadh on condition of anonymity, said numerous civilians inside the compound were confronted by attackers and held at gunpoint.
The official said a gunbattle quickly ensued when Saudi security officials became concerned the civilians were about to be injured. The official said it was not correct to describe them as hostages, because the incident happened so quickly.
"Gunships hovered overhead, huge plumes of smoke were seen all over the city, fire broke out, ambulances rushed to the scene," GRN reporter Phil Moore told CBS Radio News.
In Riyadh, U.S. Embassy spokeswoman Carol Kalin said two local staff members were injured, but all American staff were safe.
"We have accounted for all Americans on the compound in Jiddah and none of them are being held hostage," Kalin said. "We have a local work force that was on duty and we are still in the process of accounting for (them)."
Kalin said it was unclear if any of the U.S. Marine guards inside the consulate were involved in the gunbattle.
As a precaution, she said, the U.S. Embassy in Riyadh and consulate in Dhahran were closed to the public.
The attackers apparently made their way past Saudi security personnel into the interior of the diplomatic compound, the State Department official said, speaking on condition of anonymity.
"All the Americans at the consulate were able to reach secure locations" at the compound, he said, describing the injuries to the Americans as minor.
Saudi security forces, including snipers, could be seen on the roofs of buildings around the consulate compound. Thick smoke rose from the compound and helicopters hovered overhead.
The statement by a Saudi Interior Ministry spokesman, carried by the official Saudi Press Agency, said a "stray bunch" — a reference to Islamic militants — threw explosives at the gate of the consulate, then entered. Saudi security forces engaged the attackers, "killing three aggressors, and two were captured after they were hit," the statement said.
"The situation was brought under control," the statement said. It gave no further details.
The Saudi official in Riyadh said the gunmen got to an area inside the initial security gate at the consulate compound, but still outside a secondary gate that protects the consulate offices. Numerous civilians were confronted by the attackers and held at gunpoint, and the gunbattle broke out, the official said.
Area residents spoke of seeing Saudi forces enter the consulate, located inside a compound surrounded by walls at least 10 feet high and topped with barbed wire, shortly before the gunbattle was heard inside. Soon after, the gunfire stopped.
"It has taken the city of Jiddah by surprise, because this is a very serious incident and of a magnitude that we did not expect," Arab News editor-in-chief Kahlee el Maeena told CBS Radio News.
Saudi security officials said two security guards at the gate of consulate were wounded, one of them seriously, after the attackers opened fire on them before entering the mission. It was unclear if those two were the local staff that Kalin said had been injured.
Witnesses initially said they saw the attackers' car explode outside the consulate, located in the city's heart near the Red Sea coast.
But Saudi security officials later clarified that the assailants shot at security guards at the consulate's gate, then set off an explosion — using either a car bomb or grenades — and then got into the compound.
There was no immediate claim of responsibility. But Saudi officials have blamed al Qaeda operatives for the string of attacks that have hit the kingdom in the past two years.
On Islamic militant Web sites, contributors began hailing the attack even before it was over, with one person praising it as "destruction of a bastion of atheism."
"We were afraid about our brothers in the Arab peninsula, but this proves that they are well and sound, thank God," said the person who made the posting, referring to recent Saudi crackdowns on militants.
The consulate — like all U.S. diplomatic buildings and other Western compounds in Saudi Arabia — has been heavily fortified and guarded since last year's series of bombings against targets housing foreigners.
The series of attacks started in 2003, when car bombs targeted three compounds housing foreign workers in Riyadh, killing 35 people, including nine suicide bombers. Later that year, a suicide car bomb killed 17 people and wounded 122 at a compound for foreign workers in Riyadh.
Last May, 22 people were killed, including 19 foreigners, by militants who took over a resort complex in Khobar and held hostages for 25 hours. In another attack that month, militants stormed offices of Houston-based ABB Lummus Global Inc. in Yanbu, killing six Westerners and a Saudi.
In June, militants in Riyadh, the capital, kidnapped and beheaded Paul M. Johnson Jr., an engineer for a U.S. defense company.