The gunman had tried to infiltrate a security forces site when he was spotted by policemen who moved in to arrest him, the official Saudi Press Agency quoted the spokesman as saying.
The suspect opened fire at the police as he tried to escape but they shot back and he was killed, the spokesman said, adding that a policeman also died in the shootout and two more were wounded.
Authorities have opened an investigation into the motives of the gunman, who was armed with a machinegun and was identified as Nawaf al-Otaibi.
In an attack on August 23 a policeman was wounded when a gunman opened fire on a patrol in the Red Sea of Jeddah.
Also Read
But the deadliest attack occurred on August 6 when a suicide bomber detonated an explosives-packed vest in a mosque within the grounds of a police headquarters in the southern city of Abha, killing 15 people.
Eastern Province is home to Saudi Arabia's Shiite minority and most of the kingdom's oil production.