Four security officers have been killed and five others injured in a suicide attack outside the Prophet's Mosque in Saudi Arabia's Medina, Islam's second holiest city, the Saudi interior ministry said.
The bombing was the third attack to hit the kingdom on Monday, after blasts in cities of Jeddah and Qatif.
Photos posted on social media show smoke billowing from a fire outside the mosque where Prophet Muhammad is buried.
"Four security guards were martyred and five others wounded as a result of their opposition to the suicide attacker who detonated explosives near them as he was on his way to the mosque," the ministry said on Twitter.
The blast occurred just before the Maghreb (sunset) prayers when people were breaking their fast inside the mosque, visited by pilgrims from around the world for the final days of the fasting month of Ramadan.
Qari Ziyaad Patel, 36, from South Africa, was at the mosque when he heard a blast just as the call to prayers was ending.
He said many at first thought it was the sound of traditional, celebratory cannon fire, but then he felt the ground shake.
"The vibrations were very strong," Patel told the AP news agency. "It sounded like a building imploded."
Saudi Arabia's state-run news channel, Al-Ekhbariya, aired live video of thousands of worshippers praying inside the mosque hours after the explosion.
Around the same time as the Medina blast, two other explosions struck near a mosque in the eastern city of Qatif on the Gulf coast.
Witnesses said a suicide bomber blew himself up outside a Shia mosque without causing any other injuries.
They reported seeing body parts lying on the ground in the city's business district.
"Suicide bomber for sure. I can see the body" which was blasted to pieces, a resident told the AFP news agency.
Nasima al-Sada, another resident, said "one bomber blew himself up near the mosque".
A third witness told Reuters news agency that one explosion destroyed a car parked near the mosque, followed by another explosion just before 7pm local time.
There was no claim of responsibility for the attacks.
Early on Monday morning, two security officers were injured as a suicide bomber blew himself up near the US consulate in the Red Sea port city of Jeddah.
Security officers became suspicious of a man near the car park of Dr Suleiman Faqeeh Hospital which is directly across from the US diplomatic mission. When they moved in to investigate, "he blew himself up with a suicide belt inside the hospital parking", the interior ministry said.
In January, at least four people were killed in a suicide attack on a Shia mosque in the eastern al-Ahsa region.
In October, the Islamic State of Iraq and the Levant (ISIL) group claimed responsibility for a suicide bombing at a Shia mosque in Najran, in which at least one person was killed.
ISIL (also known as ISIS) had also claimed responsibility for an attack at a mosque inside a special forces headquarters in the city of Abha in August 2015. Fifteen people were killed in that attack.