Dilma Rousseff has been re-elected president of Brazil, after securing more than 51% of votes in the closest election race in many years.
An official count showed her rival, Aecio Neves, taking over 48% of the vote.
“I wanted to be a much better president than I have been until now,” Rousseff said in her victory speech.
She faced protests last year against corruption, record spending on the football World Cup and poor services.
Rousseff, who has been in power since 2010, is popular with poor Brazilians thanks to her government’s welfare programmes. But the vote split Latin America’s biggest country almost evenly in two, along lines of social class and geography.
Rousseff called on all Brazilians to unite in favourof the country’s future and said she would seek political reform.
“This president is open to dialogue. This is the top priority of my second mandate,” she told a cheering crowd in the capital, Brasilia.
She also thanked her supporters, especially her political mentor and predecessor Luiz Inacio Lula da Silva.
“I thank from the bottom of my heart our number one militant, President Lula,” Rousseff said.
Aecio Neves, admitted defeat in a speech to supporters in the southern city of Belo Horizonte, where he thanked the more than 50 million Brazilians’ who voted for him and said he had telephoned the re-elected president to congratulate her.
“I… wished her success in the administration of her next government, and I reaffirmed what I feel should be our greatest priority, to unite Brazil on the basis of an honourable project which dignifies all Brazilians,” he said at the rally.