Brazilian President Dilma Rousseff was re-elected by the narrowest margin in three decades, handing her left-leaning Workers' Party its weakest mandate as it confronts some of the country's biggest challenges in years.

After scraping by with 51.6 percent of the vote in a runoff against center-right challenger Aecio Neves on Sunday, Rousseff spoke of national reconciliation as she seeks to restart a stagnant economy, push political reform through a fragmented congress where she now has less support, and respond to widespread popular demands to improve woeful public services. These frustrations sparked angry street demonstrations just a year ago.

In her victory speech, Rousseff said "dialogue" was the first promise for her second term — but it remains to be seen how much the opposition will cede to her ideas of a statist economy given that growth has stalled, though she has managed to keep unemployment at record lows.

The president said she understood demands for a more efficient, less corrupt government.

"That's why I want to be a much better president than I have been until now," she said after the election results were announced.

During the Workers' Party time in power, the government has enacted expansive social programs that have helped pull millions of Brazilians out of poverty and into the middle class, transforming the lives of the poor.

But the globe's seventh-largest economy has underperformed since 2011, with some fearing it could put the social gains at risk.

"Dilma has social inclusion on her side, but the macroeconomic policies during her first four years in office have been very weak," said Carlos Pereira, a political analyst at the Getulio Vargas Foundation, Brazil's leading think tank. "Inflation has returned, the country is in a technical recession and public spending is out of control. It is less likely she will be able to offer social inclusion and macroeconomic stability at the same time."

The choice between Rousseff and Neves split Brazilians into two camps — those who thought only the president would continue to protect the poor and advance social inclusion versus those who were certain that only the contender's market-friendly economic policies could see Brazil return to solid growth.

Rousseff and Neves fought bitterly to convince voters that they could deliver on both growth and social advances. This year's campaign was widely considered the most acrimonious since Brazil's return to democracy in 1985, a battle between the only two parties to have held the presidency since 1995.

Neves hammered at Rousseff over a widening kickback scandal Petrobras, with an informant telling investigators that the Workers' Party directly benefited from the scheme.

Rousseff rejected those allegations and told Brazilians that a vote for Neves would be support for returning Brazil to times of intense economic turbulence, hyperinflation and high unemployment, which the nation encountered when the Social Democrats last held power.

"We've worked so hard to better the lives of the people, and we won't let anything in this world, not even in this crisis or all the pessimism, take away what they've conquered," Rousseff said before voting in southern Brazil.

In Brazil's biggest city of Sao Paulo, thousands of Workers' Party supporters gathered on a main avenue, waving banners as a truck with giant speakers blasted Rousseff's campaign jingles.

"I'm very happy because I think the construction of Brazil has barely begun and now we will have continuity," said Liliane Viana, a retired federal government worker. "I was afraid we were going to move backward. Now I am extremely excited."

Neves was a two-term governor in Minas Gerais state who left office in 2010 with a 92 percent approval rating. He surged at the end of the presidential race to score a surprise second-place position and force a runoff vote against Rousseff.

Speaking from his hometown of Belo Horizonte, he thanked the "more than 50 million Brazilians" who voted for him.

"I will be eternally grateful to each and every one of you who allowed me to dream again of the construction of a new project," he said. "I fought the good fight. I fulfilled my mission and I kept the faith."


Associated Press writer Stan Lehman in Sao Paulo contributed to this report.