He said the men were killed after they fired shots at security forces, who had surrounded a residential apartment in the Sanabis neighbourhood.
"They were called on to surrender, but they did not respond and opened fire at the security forces... which resulted in their killing," said the spokesman.
No civilians or security forces were injured in the operation, he added.
The demonstrators have demanded an end to what they say is discrimination by the Sunni-dominated government, a charge Riyadh denies.
One of the leaders of the protest movement, prominent Shiite cleric Nimr al-Nimr, was executed in 2016 for "terrorism".
Nimr's execution exacerbated sectarian tension both across the Gulf and with Saudi Arabia's main regional rival, Shiite Iran.
The Shiite community is estimated to make up between 10 and 15 percent of the kingdom's population of 32 million, but the government has released no official statistics.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)