Zanzibar is to fly its own flag for the first time in 40 years since uniting with Tanganyika to form Tanzania in 1964.
The adoption of the flag was approved unanimously by the archipelago's parliament on Monday.
The new design is dark and light blue, green, black and gold, with the Tanzanian flag shown in a corner.
The government has stressed that the adoption of a flag does not mean that this is a move towards independence.
"The flag is just a step to conform with the constitution of Zanzibar, which empowers the installation of symbols of the government," said Zanzibar Attorney General Idd Pandu Hassan.
The flag will be raised on the archipelago as soon as Zanzibar President Amani Abeid Karume signs it into law.
But Mr Hassan says it will not be flown at international forums such as the United Nations or African Union as Zanzibar is not a sovereign nation, Tanzania's Guardian newspapers reports.
Although the opposition Civic United Front (CUF), some of whose members want independence from mainland Tanzania, voted in favour of the new flag, they were not entirely happy about the new design.
"It is just unacceptable to have the flag of Tanzania inside the flag of Zanzibar," CUF leader Abubakar Khamis Bakar said during the three-day parliamentary debate.
Under the 1964 act of union, Zanzibar was allowed to remain semi-autonomous and to have its own president while benefiting from economic and political clout of the mainland.
But some critics feel that the islanders do not benefit from their contribution to Tanzania's tourism revenue.