Riding a wave of support from Rio's slums, Eduardo Paes was re-elected mayor and now takes up the challenge of overseeing major infrastructure projects ahead of the 2016 Summer Olympics.
Paes, a member of the centrist PMDB backed by the ruling Workers Party (PT), on Sunday got 64.6 percent of the vote, easily defeating his ultra-leftist rival Marcelo Freixo with 28.1 percent.
"We are going to work together over the next four years," said the incumbent, whose party is a member of President Dilma Rousseff's ruling coalition.
In municipal elections seen as a key test ahead of presidential polls two years from now, some 139 million Brazilians were called upon to elect 5,561 mayors and 48,000 municipal councilors for four-year terms. Around 450,000 candidates represented more than 20 political parties.
The surprise came in Sao Paulo, where campaign frontrunner Celso Russomanno was shut out of the key mayoral race.
Opposition Brazilian Social Democratic Party (PSDB) candidate Jose Serra will face off against PT rival Fernando Haddad in a runoff vote scheduled for October 28.
A second round will take place on the same day in cities with more than 200,000 people where no candidate secured an absolute majority.
With 99.6 percent of the votes officially counted, Serra, a former presidential candidate, had with 30.7 percent, against 29 percent for Haddad, who got the active support of Rousseff and ex-president Luiz Inacio Lula da Lula.
Russomanno, a populist ex-television consumer advocate backed by a powerful evangelical Christian church, finished third with only 21.5 percent.
He had led throughout the campaign, but his rivals closed the gap in recent days.
The PT and the PSDB are Brazil's two main parties and the post of Sao Paulo mayor is often seen as a stepping stone for candidates with presidential aspirations.
Serra, who lost to Rousseff in the 2010 presidential poll, touted his broad experience -- he previously served as congressman, senator and Sao Paulo state governor -- and suggested that Lula and the PT were tainted by the major bribery trial now before the Supreme Court.
Thirty-seven former ministers, lawmakers, businessmen and bankers are facing prosecution before the Supreme Court over the alleged scheme that ran from 2002 to 2005 during Lula's first term.
While Lula was cleared, the scandal nearly cost the 66-year-old his re-election in 2006.
Analysts had suggested that Haddad would be hurt by the vote-buying scandal.
Thanking his supporters after a strong showing, Haddad, a former academic of Lebanese descent who served as education minister under Lula and Rousseff, vowed to widen an alliance with smaller parties in order to win the runoff vote.
One of the 12 Brazilian cities that will host the 2014 World Cup, Sao Paulo suffers from economic inequality, an inadequate mass transit system, horrendous traffic, a shortage of low-income housing and a large drug addict population.
Haddad said, that unlike Serra, he had a detailed, credible program to improve the quality of life for Sao Paulo's 11 million residents.
The nationwide electronic voting is mandatory.