The gunman was killed after refusing to surrender to security forces hunting him over his suspected involvement in an attempt to infiltrate a police station parking area in the province on Sunday, a ministry statement said.
It identified him as Mohammed al-Maliki, adding that he had threatened in a video message to attack police and had been involved in a previous attack in which a policeman was killed.
The past week has seen a rise in such incidents in the kingdom, where the Islamic State group (IS) has previously claimed bombings and other attacks targeting security forces.
IS leader Abu Bakr al-Baghdadi has called Saudi Arabia's rulers "apostate tyrants" and called on Saudis to rise up against them.