The winner will be inaugurated on Peruvian Independence Day
Peruvians headed back to the polls on 4 June for a second round of voting to elect a new president.
In the running were a former president whose time in office left the economy in tatters and a nationalist former army officer who was pledging a revolution for the poor.
Exit polls suggested that the ex-President, Alan Garcia, won narrowly against Ollanta Humala.
But for many the choice had been an unappealing one and it was predicted that undecided voters would sway the balance.
Who is Alan Garcia?
Mr Garcia, 57, is a charismatic lawyer who was president of Peru from 1985 to 1990. However, his time in office was one many Peruvians would rather forget, riddled by hyperinflation, rampant corruption and surging rebel violence.
Promising to atone for past mistakes, this time round Mr Garcia recast himself as a moderate, business-friendly leftist, along the lines of Brazil's president, Luiz Inacio Lula da Silva.
He also worked hard to attract young voters, many of whom will have only vague memories of his time in office, and he was helped along by his political party, the American Popular Revolutionary Alliance, Peru's oldest and most powerful political machine.
However, in the weeks running up to the elections his pledges became increasingly populist in an attempt to win over the poorer south, and many middle class voters remained sceptical.
What did Ollanta Humala have to offer?
Mr Humala, 43, is a retired army officer who led a military uprising against former President Alberto Fujimori in 2000.
A political outsider who has never held elected office, Mr Humala's nationalist message struck a chord among poorer voters, who have seen little benefit from recent economic growth and feel let down by traditional politicians.
His promise to take a bigger bite out of foreign investors' profits, scrap the current constitution and launch a "revolution" for the poor won him first place in the first round of voting on 9 April.
But many did not share this enthusiasm. His plans to increase state control over the economy and restrict foreign investment sent jitters through the financial markets and business leaders were wary.
His campaign was also hurt by concerns over his lack of a firm policy programme, allegations of human rights violations during his time as an army commander and fears that he was too close to Venezuela's President Hugo Chavez, who voiced strong support for him.
What were the main issues?
Economic policy and foreign investment took centre stage in the run-up to the elections.
Despite recent economic growth, official figures show that 48% of Peruvians still live below the poverty line and voters are frustrated at the slow pace of job creation.
The health system is in crisis after years of underfunding and a series of doctors' strikes. Up to a quarter of the population have no access to healthcare.
Education is in urgent need of a spending boost, and many rural areas still lack access to clean drinking water and paved roads.
Voters were also looking for a clean break from the sleaze of recent years. President Alejandro Toledo's time in office was marred by a series of corruption scandals, and graft is fuelling a growing drugs trade.
Peru is now the world's second biggest cocaine-producer after Colombia, and drug-traffickers are believed to have formed alliances with the Maoist rebel group Shining Path, which waged a violent campaign in the 1980s to overthrow the state.
How does the run-off work?
To win the run-off, a candidate must simply win the most valid votes on election day.
The election went through to a run-off after none of the candidates managed to win more than half of the total valid votes in the first round on 9 April. Mr Humala obtained 30.6% against 24.3% for Mr Garcia, who narrowly beat conservative candidate and one-time favourite Lourdes Flores.
The government announced that over 52,000 police and army troops would be on duty on Sunday to ward off trouble following violent clashes between rival groups of supporters in Cuzco on 25 May.
The winner will be inaugurated on 28 July, Peruvian Independence Day. Once sworn into office, the president will appoint a prime minister, who in turn appoints a cabinet, subject to the president's approval.
BBC Monitoring selects and translates news from radio, television, press, news agencies and the internet from 150 countries in more than 70 languages. It is based in Caversham, UK, and has several bureaux abroad.