The Islamic State jihadist group claimed the attack, the second in a week.
"Authorities have managed to foil a terrorist crime targeting people performing the Friday prayers at Al-Anoud mosque in Dammam," capital of Eastern Province, said a ministry spokesman quoted by the Saudi Press Agency.
The bomber "detonated the explosive belt he was wearing at the mosque entrance as security officials were on their way to inspect him," said the spokesman, citing preliminary investigation results.
The explosion killed the attacker as well as three others and wounded four people, he said.
Also Read
The spokesman had earlier said the car exploded as security officials headed towards it. Other nearby vehicles caught fire.
The blast comes seven days after a May 22 suicide bombing on a Shiite mosque in a village in Eastern Province killed 21 people. IS also claimed that attack.
A witness of the latest attack, Nassima al-Sada, said it was carried out by a suicide bomber who blew himself up after security volunteers tried to stop him from entering the ladies side of the mosque -- the only Shiite mosque in Dammam.
Women were not allowed to pray at the mosque this week over security fears, Sada said.
In November, IS-linked gunmen killed seven Shiites in the Eastern Province town of Al-Dalwa.
Most of the kingdom's Shiite minority live in the oil-rich east but have long complained of marginalisation.