Brazil's leftist President Dilma Rousseff narrowly won re-election on Sunday after convincing voters that her party's strong record of reducing poverty over the last 12 years was more important than a recent economic slump.
After one of the closest, most divisive campaigns in Brazil in decades, Rousseff won 51.6 percent of votes in a runoff against centrist opposition leader Aecio Neves, who won 48.4 percent with more than 99 percent of the votes tallied.
At a hotel in Brasilia where Rousseff was due to speak, party supporters waved red flags and jumped up and down, screaming in celebration.
In Sao Paulo, a stronghold of Neves' Brazilian Social Democracy Party (PSDB), a more subdued mood was punctuated by some government supporters honking horns and screaming with joy.
Voting was peaceful and Brazil's robust democracy is free of the political violence that mars some other countries in Latin America.
Yet, at a time when the economy is facing deep challenges, Ideli Salvatti, one of Rousseff's top ministers, said the government would seek to lead "a national reconciliation process given how tight the result was."
"We have to calm our hearts down first and then get back to work tomorrow," she told reporters.
The result means another four years in power for the Workers' Party, which since 2003 has virtually transformed Brazil - lifting 40 million from poverty, reducing unemployment to record lows and making big inroads against hunger in what remains one of the world's most unequal countries.
The party's star has faded recently. The economy has slowed dramatically under Rousseff's heavy-handed and often unpredictable policies, making Brazil's glory days of robust growth last decade an ever-more distant memory.
Numerous corruption scandals, high inflation and frustration over poor public services like health care tempted many to consider a switch to Neves' more pro-business agenda.
Yet Rousseff and her supporters spent the campaign warning voters, especially the poor, that a vote for the PSDB would mean a return to the less compassionate, more unequal Brazil of the 1990s - an argument that Neves rigorously denied, but ultimately prevailed anyway.
"We need Dilma to continue the programs that improve the lives of those in need," said Livia Roma, 19, a university student in Sao Paulo, as she voted on Sunday. "I didn't vote for myself, but for the minorities and less fortunate classes."
Investors have generally disliked Rousseff's interventionist management of state-run companies and other sectors of the economy, and Brazil's financial markets plummeted last week when polls showed she was likely to win a second term. They could see another selloff on Monday.
With 200 million people and a gross domestic product of some $2 trillion, Brazil is Latin America's largest economy and its most populous country.
By re-electing Rousseff, it will remain on a middle ground between more socialist governments in Venezuela and Argentina, and the freer-trading, faster-growing countries on the Pacific coast that include Colombia and Chile.
Rousseff owed her victory to overwhelming support from the roughly 40 percent of Brazilians who live in households earning less than $700 a month.
They have benefited from the Workers' Party's rollout of a program that pays a small monthly stipend to one in four Brazilian families, as well as federal housing programs, government-sponsored vocational schools and an expansion of credit to the working class.
Rousseff, 66, is unlikely to enjoy much, if any, of a honeymoon when her second term starts on New Year's Day.
Recent allegations of systemic corruption at state-run oil giant Petrobras (PETR4.SA) roiled the final days of the campaign and are likely to be a major political headache in coming months and years as prosecutors pursue those responsible.
The economy slipped into a recession earlier this year, and ratings agencies have warned that a credit downgrade is possible unless Rousseff makes hefty spending cuts to correct deficits that have mushroomed in recent months.
Her aides have said she will try to win back the confidence of financial markets by announcing a more pragmatic finance minister for her second term, although many investors worry that Rousseff will continue to call most of the shots herself.
The election was one of the most dramatic since full democracy returned to Brazil in 1989. One candidate was killed in a plane crash in August, and his replacement then soared into the lead in opinion polls, only to fade in the final days before the first round of voting on Oct. 5.
During the runoff, senior leaders from both parties compared their rivals to Nazis - a break from the relatively genteel tone that has prevailed in Brazilian politics in recent years, and one that analysts say heralds a more divisive era ahead.
That, in turn, may make consensus on a much-needed overhaul of the tax code and other economic reforms more difficult for Rousseff to push through.
FROM TECHNOCRAT TO PRESIDENT
Rousseff, who was jailed and tortured in the early 1970s for opposing that era's military dictatorship, is the country's first woman president. The daughter of a Bulgarian aristocrat who emigrated to Brazil during World War Two, she was a relatively obscure government technocrat until her predecessor Luiz Inacio Lula da Silva hand-picked her as his successor.
Many in the Workers' Party are already thinking ahead to the next election in 2018, when Lula, who governed from 2003 to 2010, has said he may run again. Brazil's constitution doesn't allow presidents to seek a third consecutive term.
Neves' PSDB, meanwhile, faces an uncertain future after falling short in three straight presidential contests due in part to its image as the party of Brazil's wealthy minority.
The PSDB is under added pressure because of a long drought in Sao Paulo state, which it governs, that has raised the prospect of severe water rationing in coming months.