Paraguay's Mario Abdo Benitez, who represents the country's long-dominant Colorado conservatives, was elected as president on Sunday, landing the top job in one of Latin America's poorest countries.
The US-educated son of a senior aide to the country's late dictator, Abdo Benitez won slightly more than 46 percent of the vote, with his centrist opponent Efrain Alegre taking almost 43 percent in a race that was far closer than expected.
Opinion polls had consistently given Abdo Benitez, 46, a clear lead of up to 20 points over Alegre in a two-man contest to succeed outgoing conservative President Horacio Cartes.
Greeting thousands of excited supporters outside the party headquarters, Abdo Benitez pledged to win the trust of those who did not vote for him.
Through the election, Paraguay had "set an example" and shown that "democracy is well established" in the country, he said, before paying homage to his father, whom he described as "a great member" of the Colorado party.
Despite a slow start, turnout stood at 65 percent by the time polling stations closed at 4:00 pm (2000 GMT). As the counting got under way, it quickly became clear the results would be much closer than anticipated.
Analysts said electing Abdo Benitez, the son of the personal secretary to dictator Alfredo Stroessner, suggested that Paraguayans had managed to turn the page on the darkest chapter of their recent history.
Landlocked Paraguay -- sandwiched between Argentina, Bolivia and Brazil -- has enjoyed consistent economic growth under tobacco magnate Cartes, but has failed to shake off persistent poverty, corruption and drug trafficking.
It remains a land of contrasts, still marked by the 1954-1989 dictatorship of General Stroessner.
However, a new generation of voters among the electorate of 4.2 million -- born after the dictatorship responsible for the deaths or disappearances of up to 3,000 people -- seems ready to look to the future.
"Most people feel resentful towards Cartes," 18-year-old student Alex Gimenez told AFP.
In Paraguay, 43 percent of the population is aged between 18 and 34.
- A vote for change? -
Ahead of the vote, Abdo Benitez appeared confident his background would not affect his chances.
"I have earned my democratic credentials on my political journey," he said.
But Alegre had banked on people voting for change after almost 70 years of dominance by the ruling Colorado party.
Accepting that his rival had won three percentage points more than him, Alegre said that nothing could stop the pace of change.
"We think change in Paraguay is irreversible, better sooner than later," he said.
Writing in Americas Quarterly magazine, Oliver Stuenkel, professor of international relations at Sao Paulo's Getulio Vargas Foundation said the Colorado party had become increasingly aware of the public desire for change.
"Paraguayan society is changing faster than its political elite and a generation is gaining influence that has no clear memory of non-democratic rule -- a first in Paraguayan history," he wrote.
"Whoever succeeds Cartes... will have to contend with a new generation that is out to change Paraguay for the better."
Voters also cast their ballots for a new parliament and governors of the country's 17 departments.
- Growth, but grinding poverty -
Tobacco magnate Cartes kept Paraguay on course for year-on-year growth of about 4.0 percent in an economy whose major exports are soybeans, beef and hydroelectric power.
But there has been little progress in alleviating poverty that has remained stubbornly at 26.4 percent and corruption, with Paraguay languishing 135th out of 180 countries ranked by Transparency International.
The outgoing president himself admitted that Paraguay had "social debts" and that "everything needs to be done."
"It is just not conceivable that with all the richness we have in a country of seven million people, that we have such poverty," he said after casting his ballot.
Abdo Benitez, who goes by the nickname "Marito," has pledged to reform the judicial system to render it less prone to corruption, but to maintain Cartes' economic policy.
And the odds have long been stacked in his favor: the only time the country had a president who did not come from the Colorado party was in 2008-2012, when former Catholic bishop Fernando Lugo ruled.