Following the attack near King Fahd sports stadium, a shootout ensued between the gunman and the security forces, a police spokesperson said in a statement carried by the official SPA news agency.
The assailant was wounded and subsequently arrested, police said, without identifying him.
Tuesday's shooting was the first deadly attack on Westerners in Saudi Arabia since several were killed in a wave of al Qaeda violence between 2003 and 2006.
It comes as Saudi Arabia participates in a US-led campaign of air strikes against militants of the Islamic State group (IS) in Syria.
But there was no immediate indication of any links between the attack and the more than three-week campaign.
In January, a Saudi court sentenced to death an al Qaeda militant and jailed 10 others over a May 2004 attack that killed six Westerners and a policeman.
The defendants, seven of whom are brothers, were convicted of aiding assailants who attacked a US company in the northwestern port town of Yanbu, killing two Americans, two Britons, an Australian and a Canadian, as well as a Saudi.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ