A suicide bombing outside one of Islam's holiest sites killed four Saudi security officers and wounded five others.
Similar attacks outside a Shiite mosque and a US Consulate in two other Saudi cities raised fears of a co-ordinated assault aimed at destabilising the Western-allied kingdom.
The attack happened outside the sprawling mosque grounds where the Prophet Muhammad is buried in Medina. Millions of Muslims from around the world visit the mosque every year as part of their pilgrimage to Mecca.
The interior ministry said the attacker set off the bomb in a car park after security officers raised suspicions about him.
Several cars caught fire and thick plumes of black smoke were seen rising from the site of the explosion as thousands of worshippers crowded the streets around the mosque.
No group has yet claimed responsibility for any of the attacks.
Altayeb Osama, a 25-year old Sudanese visitor to Medina and resident of Abu Dhabi, said he heard two large booms about a minute apart as he was heading toward the mosque for sunset prayers.
He said police and fire engines were on the scene within seconds.
"It was very shocking that such a thing happens in such a holy place for Muslims, the second holiest place in the world. That's not an act that represents Islam," he said.
"People never imagined that this could happen here."
The ruling Al Saud family derives enormous prestige and legitimacy from being the caretakers of the hajj pilgrimage and Islam's holiest sites in Mecca and Medina. The attack may have been an attempt to undermine the Saudi monarchy's claim of guardianship.
In 1979, extremists took over Mecca's Grand Mosque, home to the cube-shaped Kaaba, for two weeks as they demanded the royal family abdicate the throne.
Last year, the Saudi government was accused of gross negligence by regional enemies, primarily Iran, after a crush of pilgrims during the annual hajj killed at least 2,426 people and a crane collapse over the Grand Mosque killed 111 worshippers.
The Prophet Muhammad's mosque was packed on Monday evening with worshippers during the final days of the Muslim holy month of Ramadan, which ends in the kingdom on Tuesday.
Local media say the attacker was intending to strike the mosque when it was crowded with thousands of worshippers gathered for the sunset prayer.
State-run news channel al-Ekhbariya aired live video of the mosque filled with worshippers praying hours after the explosion. It also showed footage of Saudi King Salman's son and the Governor of Medina, Prince Faisal bin Salman, visiting security officers wounded in the blast and the site of the explosion.
Also on Monday evening, at least one suicide bomber and a car bomb exploded near a Shiite mosque in eastern Saudi Arabia, several hours after a suicide bomber carried out an attack near the US Consulate in the western city of Jiddah.
Saudi Arabia has been a target of Islamic State attacks that have killed dozens of people. In June, the interior ministry reported 26 terror attacks in the last two years.