SAO PAULO — A millionaire businessman who used to tell people “You are fired!” as host of a reality TV show won the mayoral race in Brazil’s biggest city Sunday, underscoring voters’ myriad beefs with traditional politicians and handing a stinging defeat to both President Michel Temer and the Workers’ Party that his supporters ousted.

Joao Doria, the former host of “The Apprentice Brazil,” won with 53 percent of vote after campaigning on the slogan “I’m not a politician, I’m a businessman.” He beat out a crowded field that included incumbent Fernando Haddad, a key member of the Workers’ Party, and former mayor Marta Suplicy, a new ally of Temer.

“I always believed this could happen, even when I started with 3 percent in the polls,” the mayor-elect said at a news conference. “Expect me to be a good manager. It is possible to make policy without being a politician. I beat a lot of politicians in this election.”

Doria, from the right-leaning Brazilian Social Democratic Party, had led in the polls going into the election but had not been expected to win the majority needed to avoid a runoff. His first-round victory in Sao Paulo, the engine of Brazil’s economy and a bellwether for the national stage, could have strong implications for the presidential election in 2018.

Sao Paulo state Gov. Geraldo Alckmin, a stalwart Doria supporter, will likely benefit as he eyes a presidential run. Alckmin ran for president in 2006 and lost to then President Luiz Inacio Lula da Silva, who backed Haddad and a number of other losing candidates in Brazil’s richest state.

Silva, who governed Brazil in 2003-10, is also a presidential hopeful, though he is dogged by several corruption allegations related to the sprawling investigation into kickback scheme at state oil company Petrobras.

“The Workers’ Party needs to go. I’m looking at the big picture,” said Helio Soares da Cunha, a 74-year-old retiree who supported Doria.

In Rio de Janeiro, Brazil’s second largest city, Temer and Mayor Eduardo Paes suffered a big defeat as their candidate, Pedro Paulo Carvalho, finished third. A runoff will pit two of their biggest adversaries: an evangelical pastor who is now a senator and a human rights activist who has a seat in the state legislature. Sen. Marcello Crivella finished first with almost 28 percent of the vote, followed by Marcelo Freixo at almost 19 percent. Both rejected the support of Temer’s and Paes’ party, the Brazilian Democratic Movement Party. .

During the campaign for municipal posts across Brazil, opinion polls showed outsiders running well by promising to stamp out endemic graft and upend the politics-as-usual that led Latin America’s largest nation to its largest political crisis since Fernando Collor was impeached in 1992.

In August, the Senate voted to remove President Dilma Rousseff for illegally shifting funds between federal budgets. Rousseff, Brazil’s first female president who was in her second term, denied the allegations. During the nearly yearlong fight she called ouster campaign a modern day “coup d’etat” by the elite furious over the social welfare spending of the Workers’ Party.

In the background of the nearly yearlong impeachment fight was a cascade of revelations from the corruption probe at Petrobras. Several businessmen and politicians from several major parties have been jailed in the kickback scheme that authorities say resulted in more than $2 billion in bribes.

“Politicians are a terrible race unto themselves,” said Regina Fontes, a 64-year-old retired school teacher in Rio who had yet to decide on a candidate before entering the voting booths. “They make all kinds of promises and then what do they do? They steal.”

While new faces dominated Sunday, the old divisions between Rousseff supporters and those who wanted her out were evident.

Temer, who was Rousseff’s vice president and took over after her ouster, was slated to vote at 11 a.m. in Sao Paulo. With Rousseff supporters planning a protest against him, he surprised polling officials when he showed up at 8 a.m. before any demonstration could mobilize.

Associated Press writer Mauricio Savarese reported this story from Sao Paulo and AP writer Peter Prengaman reported from Rio de Janeiro.

Mauricio Savarese on Twitter:

Peter Prengaman on Twitter: