Four foreign nationals and three Afghans were also injured in the attack when gunmen opened fire, said interior ministry spokesman Abdul Mateen Qani. Four people have been arrested, he said.
Taliban officials did not immediately reveal the nationality of the tourists and the identity of the attackers.
According to preliminary information provided by hospital sources, the three foreigners who were killed were Spanish nationals.
The wounded were from Norway, Australia, Lithuania and Spain.
Diplomatic sources said they were seeking to confirm the information, including the identities of the dead.
Mountainous Bamiyan is home to a UNESCO world heritage site and the remains of two giant Buddha statues which were blown up by the Taliban during their previous rule in 2001.
Since taking over Afghanistan in 2021 the Taliban have vowed to restore security and encourage a small but growing number of tourists trickling into the country and sell tickets to access the Buddha statues.
Qani did not say if there had been multiple shooters in Friday's attack.
The Taliban government "strongly condemns this crime, expresses its deep feelings to the families of the victims and assures that all the criminals will be found and punished", Qani said in a statement.
A local resident, who did not want to be named, said he "heard the sounds of successive gunshots, and the city streets leading to the site were blocked immediately by the security forces".
Deadly attacks on foreigners have been rare in Afghanistan since the Taliban returned to power in August 2021.
Tourists have been traveling to the country in increasing numbers in recent years as security has improved since the Taliban ended their insurgency after ousting the US-backed government.
Arriving in western Herat province Friday evening, a foreign tourist posted on a WhatsApp group for travelers in Afghanistan that he and others were stopped by the Taliban authorities and told "that because of Bamiyan we were no longer safe".
"After some time and Google translate, we convinced them to let us go, they said go eat quickly and get off the streets," the tourist said.