Five “terrorists” carried out the attack on Bardo Museum, and two of them were killed by security forces, Essid said at a press conference, according to Xinhua news agency.
A Tunisian citizen and a a policeman were also killed in the attack, Essid said.
The prime minister pointed out that about 100 tourists were inside the museum when it was attacked.
BBC cited Essid as saying that Italian, Spanish and German citizens were among those killed.
At the time of the attack, deputies were discussing an anti-terrorism legislation, the BBC report said.
British, Italian, French and Spanish nationals were among those taken hostage during the attack, local radio reported.
According to an earlier report, the group of militants disguised as soldiers entered the Bardo museum through the Tunisian parliament building.
Gunshots were heard on Wednesday morning near the parliament complex, which was immediately evacuated.
Bardo Museum is the biggest Tunisian museum and is a major tourist attraction.
It is renowned for its countless pieces coming from the excavations undertaken in the country since the 19th century.
Tunisia is where the Arab Spring revolution began in 2010.