The killings, in Saihat in Eastern Province on October 16, come two days after the start of Ashura commemorations, a holy occasion for Shia Muslims.
A group claiming links to Islamic State (ISIS) said it carried out the attack.
The Saudi Arabian interior ministry said a gunman opened fire at random before police intervened and shot the attacker dead.
Later, a group calling itself Islamic State-Bahrain State said that one of its “soldiers” had attacked “a Shia infidel temple” with an automatic weapon.
The group warned that “infidels will not be safe in the island of Mohammed”.
Correspondents say the name of the group appears to be a reference to the historic area of Bahrain, which once encompassed parts of what is now Saudi Arabia.
Other, smaller attacks against the Shia community in the east of Saudi Arabia were also reported on Friday evening.
The minority Shia community in Saudi Arabia is increasingly being targeted. Most live in the oil-rich east, and many complain of discrimination.
In May, ISIS said it had carried out a deadly bomb attack outside a Shia mosque in the city of Damman.
A week before, more than 20 people were killed in the village of al-Qadeeh when an ISIS suicide bomber struck during Friday prayers at a Shia mosque.
That attack was the first to be claimed by a Saudi branch of ISIS.
Hardline Sunnis regard Shia Muslims as heretics.
Saudi Arabia, which is part of a US-led coalition against ISIS in Syria and Iraq, has previously been threatened by ISIS.
The Saudis are also leading a coalition of Arab states in an air campaign against Shia rebels in Yemen.
In the Ashura commemorations, Shias mourn the death of Hussein, a venerated grandson of the Prophet Muhammad.
The US House Ethics Committee has voted to release its report on former Republican Representative…
ABC News has agreed to pay $15 million to President-elect Donald Trump to settle a…
South Korea’s parliament has voted to impeach President Yoon Suk Yeol over his failed attempt…
Israeli war planes have carried out more than 100 air strikes in Syria on December…
President-elect Donald Trump has threatened to impose 100% tariffs on the BRICS countries if they…
Syrian troops have withdrawn from the city of Aleppo following an offensive by rebels opposed…