"I am here to declare that the ban on political rallies is now lifted," President Samia Suluhu Hassan told a gathering of political leaders at the State House in Dar es Salaam.
"The government will be responsible for ensuring security during rallies, but I urge all politicians to also practice civilized politics," she added.
Hassan took power after the death of John Magufuli in 2021, has been under pressure to break with some of the more hardline policies of her predecessor, who came to power in 2015 as a no-nonsense man of the people but became accused of crushing dissent.
Nicknamed "the Bulldozer" for his uncompromising style, Magufuli banned political rallies early in his first term, but critics said the ruling was applied only to opposition groups.
Free speech and the press were also curbed and opposition leaders detained in a sweeping crackdown on dissent under his leadership in a country once seen as a democratic beacon in East Africa.
Hassan has sought to make conciliatory moves to the opposition since taking office, but has previously been branded a "dictator" by her critics, and fears remain about the state of political and media freedoms.
In 2021, a newspaper owned by the ruling party was suspended for publishing a story saying Hassan would not run for office in 2025.