The BBC's Rana Jawad in Tunis says their release is being linked to a recent Tunisian court decision to deport a Libyan militia commander.
Walid Kalib is a commander of one of the brigades in the "Libya Dawn" alliance which controls Tripoli.
Libya Dawn spokesman Jamal Zubia on Wednesday wrote on his Facebook page:
"The page of the Tunisian consulate will be turned and they will return to their families and the revolutionary hero Walid Kalib returns to his family,'' reports AP news agency.
He was recently arrested in Tunisia on terrorism charges.
After the workers' release, Mr Bakouch urged all Tunisians to leave Libya.
"We cannot again be subject to any blackmail," he said, according to the Reuters news agency.
However, he said that the decision to deport Mr Kalib had been taken by the courts, independently of his ministry.
The 10 workers were abducted last week from the Tunisian consulate in the capital, Tripoli.
Libya descended into chaos after the uprising that led to the overthrow of Colonel Muammar Gaddafi in 2011.
There has been no central government since then, with different militia groups competing for power.
Most countries closed their embassies during the fighting that ensued, but Tunisia has recently sent consular staff back to Tripoli.
The UN is trying to negotiate a political settlement to the crisis in Libya, after insecurity in the capital forced Libya's internationally recognised parliament and government to relocate to the eastern city of Tobruk.
Libya Dawn last year seized control of Tripoli and surrounding areas.