An evangelical mega-church bishop who once branded Catholics demons was elected mayor of Rio de Janeiro on Sunday, in nationwide municipal elections that confirmed the decline of the former ruling Workers’ Party.

In the first round earlier this month, the Workers' Party of ousted president Dilma Rousseff had already lost about two thirds of the city halls it won in 2012, including Brazil's largest city, Sao Paulo.

The drubbing underlined the decline of a party founded by ex-president Luiz Inacio Lula da Silva and comes after the removal from office of his successor in an impeachment trial in August.

The biggest winner emerging from the elections has been the center-right PMDB of new President Michel Temer and allied parties, especially the PSDB.

"The Temer government's base came out with a big win," said political scientist Fernando Schuler in Sao Paulo.

Schuler said losses by the Workers' Party in heartland municipalities, including San Bernardo do Campo in Sao Paulo, "reinforced the tendency seen in the first round -- a defeat for the former government's political bloc".

But the highlight of Sunday's runoff elections was a battle for Rio's post-Olympics future between socialist Marcelo Freixo and Crivella, the evangelical bishop who represented the Brazilian Republican Party (PRB).

Crivella -- a bishop in the giant Universal Church of the Kingdom of God, founded by his billionaire uncle -- won with an easy 59.4 to 40.6 percent, final results showed.

He has promised to bring law and order to Rio, a city beset by high crime. Despite billions of dollars in investments for the Olympic Games this year the city also suffers from ramshackle infrastructure, including a lack of basic sanitation for many in the impoverished favela neighborhoods.

Casting his vote in Copacabana, Crivella said he would dedicate himself "above all to health, education, transport and public safety".

Corruption fuels evangelical surge

Evangelical politicians are advancing steadily nationwide, helped by disgust over revelations of systemic corruption among business executives and leading politicians from across the political divide.

The evangelical message has also taken root among the poor, who earlier would have been expected to vote more along leftist lines. Several high profile cases of evangelical leaders also caught up in corruption allegations have yet to damage the movement.

Crivella himself faces controversy.

He has had to work hard to distance himself from statements he made in a book he wrote in 1999 in which he described Roman Catholics as "demonic" and claimed that Hindus drank their children's blood. He has also described homosexuality as evil and African religions as worshipping "evil spirits”.

Freixo, 49, of the Socialism and Freedom Party, was a dramatically different candidate, advocating socially liberal policies. He won strong support among the city's cultural elite and pro-gay activists.

Mauricio Santoro, a political analyst at Rio de Janeiro State University, said Brazilians are rejecting mainstream politicians and that Crivella and Freixo are signs of the polarized times.

"How is it possible that in Rio de Janeiro, a city of joy and openness about sexuality, there will be a mayor who is very conservative, discriminates and opposes Afro-Brazilian religions? The (centrist) alliance that governed the city has broken," he said.

Schuler said centre-right forces had made impressive gains and will look to the presidential elections in 2018.

However, those parties face a conundrum: Now they will have to govern just when Brazil is embarking on painful and potentially unpopular economic reforms to escape recession.