“At 6:45 pm (1545 GMT), a man stopped in a car in front of the consulate building and got out with a weapon in his hand,” the official Saudi Press Agency quoted a police spokesman as saying.
“Security forces reacted… resulting in an exchange of fire that killed the assailant,” it said, adding that the Nepalese guard later died of his wounds.
The shooting coincided with the final day of the hajj at nearby Mecca. More than 1.6 million foreign pilgrims arriving on planes and boats have streamed through coastal Jeddah en route to the rituals.
“Security investigations are still underway to ascertain the circumstances” of the incident, the police spokesman said.
The gunman’s nationality has not been revealed. US officials said no Americans were hurt and that the consulate had been secured.
“We offer our sincere condolences to the family and loved ones of the deceased local guards member,” the State Department said in a statement in Washington.
“The consulate was appropriately locked down and no Americans were harmed in the attack,” it said.
The United States was in touch with the kingdom as it starts its investigation, the statement added.
Secretary of State Antony Blinken visited the city earlier this month when he met Crown Prince Mohammed bin Salman, Saudi Arabia’s de facto ruler.