Polish, Italian, German and Spanish tourists were among the dead, Prime Minister Habib Essid said, adding that two gunmen had been killed.
A Tunisian national and a policeman were also reported dead.
Essid said the gunmen, dressed in military uniforms, opened fire on the tourists as they were disembarking from a bus and chased them inside the museum.
Health Minister Said Aidi told reporters that 38 others had been wounded in the attack, including citizens of France, South Africa, Poland, Italy and Japan.
The attack appeared to be the worst on foreigners in Tunisia since an al Qaeda suicide bombing on a synagogue killed 14 Germans, two French and five Tunisians on the island of Djerba in 2002.
Some officials, including French Prime Minister Manuel Valls, had said hostages were taken at the museum but this was not confirmed by Tunisian authorities.
There was no immediate claim of responsibility for the attack but Tunisia -- the birthplace of the Arab Spring revolutionary movement -- has struggled to tackle a rise in attacks from extremists.
Interior ministry spokesperson Mohamed Ali Aroui told reporters that "two or more terrorists armed with Kalashnikovs" had targeted the Bardo National Museum next to the Tunisian parliament.
Aroui said about 100 tourists had been inside the museum at the time of the attack.
He said "anti-terrorist units" had entered the museum but refused to confirm reports of a hostage taking.
In Brussels, Valls said he condemned "this terrorist attack in the strongest terms", adding that there had been a "hostage taking".
French President Francois Hollande also expressed his country's "solidarity" with Tunisia, a former French colony.
President Beji Caid Essebsi was to make a public statement to the nation, spokesperson Moez Sinaoui told AFP.
The Bardo National Museum, a famed repository of ancient artefacts, is located next to the Tunisian parliament, where work was suspended during the attack.
A lawmaker, Monia Brahim, told AFP that gunfire from the initial assault prompted parliamentary committees to suspend their meetings as lawmakers were ordered to assemble in the main chamber.
"There was enormous panic," another lawmaker, Sayida Ounissi, wrote on Twitter, saying the attack took place during hearings on Tunisia's anti-terrorism law.
La panique est énorme. En pleine audition des forces armées sur la loi anti terroriste. J'ai été évacuée avec Ameur Laraied.
— Saida Ounissi (@SaidaOunissi) March 18, 2015
Tunisia has seen an upsurge in extremism since the 2011 revolution that ousted longtime strongman Zine El Abidine Ben Ali.
Dozens of police and military personnel have been killed or wounded in attacks blamed on militants.
An army offensive against militants, who are linked to al Qaeda in the Islamic Maghreb, has been underway since 2012 but the ground and air campaign has failed to eliminate them.
The country is also fighting against the radicalisation of Muslim youth, with authorities saying as many as 3,000 Tunisians have gone to Iraq, Syria and neighbouring Libya to fight in militant ranks, including with the Islamic State group.
Some 500 are now believed to have returned to Tunisia.
Essebsi said the government's "top priority" is "providing security and the battle against terrorism" after it took office last month following Tunisia's first free elections.
Tunisia kicked off the Arab Spring with its overthrow of Ben Ali and, despite the continued unrest, has taken pride in forming a stable and democratic government.
The country is hoping to rebuild its once-burgeoning tourism industry, which is struggling to recover from the effects of the 2011 revolution.
Tourist arrivals dropped by three per cent last year.
The Bardo museum, renowned for its exceptional collection of ancient mosaics, is a significant draw and opened a new wing in 2012 following a major facelift.
It boasts objects from prehistory, the Phoenician period and Punic and Numidian times, as well as Roman, Christian and Islamic artifacts.
Its curator had described it as "the flagship" of Tunisia's heritage.
Housed in a former palace dating from the 19th century, the museum greeted hundreds of thousands of visitors every year before the revolution. In 2011 the number dropped to about 100,000 but attendance had been recovering.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ