Brazilians voting in mayoral and municipal elections have given the president's Workers' party wins in several cities, according to early results and exit polls.
Luiz Inacio Lula da Silva's party won mayoral races in at least four state capitals on Sunday, but did worse than expected in Sao Paolo, the country's largest city.
Candidates from the ruling party – which controlled 17 of Brazil's 79 largest cities going into the elections - also won enough votes in several cities to qualify for a run-off election later in the month.
Analysts expected the ruling party to make significant gains on the back of Lula's record 80 per cent approval rating in opinion polls and a strong performance would boost the party's chances in the next general election in 2010, when the constitution mandates that Lula must stand down after two four-year terms.
While electoral authorities reported no major fraud or violence in the country, security was tightened in Rio de Janeiro where drug gangs and militias had threatened some candidates during the campaign.
Seven people were also reportedly shot dead in isolated incidents and more than 800 arrested - including 101 candidates.
The Superior Electoral Court said after voting ended that 2,511 polling violation complaints had been registered during the day, resulting in 808 arrests.
Many of the 101 candidates apprehended were running in the largely rural states of Minas Gerais, Espiritu Santo and Mato Grosso, it said.
A 30-year-old unidentified man was also shot and wounded in the leg by guards when he ignored warnings and tried to enter Lula's official residence in the capital Brasilia, officials said.
Lula was not there at the time, having gone to his southwestern home town of Sao Bernardo do Campo to vote.