Colau's victory came after he reached a deal with the socialists and won unexpected support from France's former prime minister Manuel Valls.
Hundreds of independence supporters filled the square in front of the city hall as voting took place in a constituent session also attended by Joaquim Forn, Catalonia's former regional interior minister who is in jail and on trial over a failed secession bid in October 2017.
Forn, who was elected as a councillor in municipal elections on May 26, was allowed to leave prison temporarily to attend the session.
Colau narrowly lost those local elections to Ernest Maragall, a veteran politician from ERC, a party that wants Catalonia — the northeastern region ruled by separatists — to be independent from the rest of Spain.
He gained 10 seats out of 41 in the city council, as did Colau. Maragall beat her by fewer than 5,000 votes.
If he had gained the necessary support to get an absolute majority of 21 in the city council, he would have become Barcelona's first separatist mayor in modern Spanish history.
That would have been a significant change in Spain's second biggest city, a tourist magnet, as the independence movement moves to conquer new power centres in Catalonia.
But in Saturday's constituent session, Colau was re-elected with 21 votes.
The vote is anonymous but Colau had already reached an agreement with the Socialist Party to support her.
Valls, who grew up in Paris with a Catalan father and Swiss-Italian mother, had also pledged to throw his councillors' support behind Colau despite criticising her during the campaign, in order to avoid Barcelona falling in the hands of Catalan separatists.
“Of utmost importance was to avoid Barcelona having a pro-independence mayor,” Valls said after the vote. “But I voted for you Mrs Colau, without conditions,” he added, saying that without his support and that of two of his councillors, as well as the Socialists, she would not be mayor.