Rouseff says she wants to be a ‘better president’ after fighting off strong challenge by Aécio Neves

President Dilma Rousseff has struck a conciliatory tone after her victory in the closest Brazilian election in generations.

Rousseff was re-elected by a narrow margin on Sunday, ensuring that Latin America’s biggest nation will remain under the control of a Workers party (PT) committed to tackling inequality.

She won 51.6% of the valid votes cast to secure a much reduced mandate, having fought off a strong challenge by the pro-business Aécio Neves.

In a victory speech, a beaming Rousseff said she hoped the nation could rally together. “Instead of increasing differences and creating gaps, I strongly hope that we create the conditions to unite,” she told supporters in Brasilia. “I want to be a much better president than I have been until now.”

She gave particular thanks to former president Luiz Inácio Lula da Silva, who many tip to run again in 2018. Rousseff is ineligible to stand for a third consecutive term.

Brazil’s stock exchange lost six points early on Monday, and its currency has fallen against the dollar in the first hours of trading. Analysts had predicted the market would react negatively to a Rousseff victory, under whom the economy has largely stalled. Neves was overwhelmingly favoured by Brazil’s business community, who believed his market-friendly policies would help jumpstart growth.

Neves said he had called the president to offer his compliments and expressed thanks to supporters.

In Rio de Janeiro, more than a thousand Workers party supporters braved driving rain to gather under the arches in Lapa, where they watched the results come in on a giant screen. As Rousseff’s victory flashed up, they erupted in cheers, waved campaign flags, danced and chanted, “Olé, olé, olé, olé, Dilma, Dilma!”

“This is good for Brazil,” said one campaigner, Vinicius Barchilon. “Dilma has done a lot for the poor and we have a government that is determined to tackle inequality.”

Facebook Twitter Pinterest Dilma Rousseff supporters in Rio de Janeiro. Photograph: Pilar Olivares/Reuters

Rousseff’s support remained strong in the poor north and north-east, areas that have benefited most from state development projects and where a high proportion of the electorate are recipients of bolsa familia, a poverty relief programme that covers almost a quarter of the population. But she lost many voters in the more affluent south-eastern cities of São Paulo and Rio de Janeiro due to middle-class frustration with the moribund economy and corruption scandals.

Voters appeared divided – and confused – by an often dirty campaign characterised by name-calling, accusations of corruption, nepotism and incompetence, rumour-mongering on social networks and suspicious delays in the release of government data on deforestation and poverty.

The overwhelmingly anti-Rousseff mainstream media focused on a huge bribes-for-votes scandal in which kickbacks from the country’s biggest company, Petrobras, were used to buy off politicians and fill campaign coffers. A report in Veja magazine this week claimed that Rousseff and her predecessor, Da Silva, were aware of the wrongdoing, a charge they deny.

Neves made this the focus of his appeal to voters. “There’s one measure above all others to end corruption: vote the PT out of office,” he said during the final televised debate.

But his message was ultimately drowned by a string of attacks. The Workers’ party accused Neves of corruption for building an airport on his family’s land, of nepotism by adding half a dozen cousins and relatives to the public payroll during his time as governor of Minas Gerais state, and of disrespecting women – an allusion to a widely circulated report that he punched his wife before they were married. Neves’ denial failed to stop his support plunging among female voters.

Facebook Twitter Pinterest Supporters of Aécio Neves at campaign headquarters in Belo Horizonte. Photograph: Sergio Moraes/Reuters

The name-calling was no more edifying. Neves compared Workers’ party campaign manager João Santana to the Nazi propaganda chief Joseph Goebbels. In response, Lula da Silva said the Social Democrats persecuted the poor north-east region of Brazil in the same way the Nazis maltreated the Jews, and that Neves, whom he has described as a drunk and a playboy, was as intolerant as King Herod.

Nonetheless, the 143 million eligible voters appear to have carried out their electoral duties peacefully – if not enthusiastically. Although voting is mandatory, more than 29 million abstained and about 7 million votes were blank or nullified.

Rousseff, a marxist guerrilla during her student years, has pledged to build on her government’s success in reducing inequality. Over the 12 years of Workers party rule, almost 40 million people – or a fifth of the population – have moved out of poverty. The rich-poor gap remains one of the highest in the world, but the Gini coefficient measure of inequality of 0.49 is down from 0.56 in 2001 and unemployment is close to record lows.

But the overall condition of the economy is less impressive. Brazil entered a technical recession earlier this year and the financial markets have turned more sharply against the Workers party. A key indication of how Rousseff, an economist by training, plans to turn this around will be her choice of finance minister. The current holder of the post, Guido Mantega, is standing down at the end of the year.