Mexicans gear up for the election
Mexicans went to the polls on 2 July to elect a new president, 500 members of the Chamber of Deputies and 128 members of the Senate.
The single-round presidential election produced an outcome so close that the result will not be known officially until Wednesday.
Voters were also electing governors in the states of Guanajuato, Jalisco and Morelos and the mayor of Mexico City.
Five candidates were running for president. The frontrunners were Andres Manuel Lopez Obrador, the ex-mayor of Mexico City, and his conservative rival Felipe Calderon.
If Mr Lopez Obrador wins, he will become Mexico's first left-wing president since democratic reforms were introduced in 2000.
Who was standing for president?
Andres Manuel Lopez Obrador - PRD/Alliance for the Good of All
A former Indian-rights activist who rose from humble origins in Tabasco State to become a hugely popular mayor of Mexico City, Mr Lopez Obrador, 52, has a reputation for honesty and hard work. His campaign was fought under the banner "For the Good of All, the Poor First", and pledges included improving healthcare and education.
If elected he has promised to crack down on corruption and tax evasion, boost public spending and review Mexico's position in the North American Free Trade Association (Nafta), which has left the business community skittish.
Felipe Calderon - National Action Party (PAN)
A Harvard-educated lawyer and former energy secretary, Mr Calderon, 44, is favoured by the business community and has said he will continue the free market policies pursued by President Vicente Fox. A career politician from Michoacan, he has pledged an "iron fist" on crime and life sentences for kidnappers.
Negative TV ads against his main rival, proclaiming that "Lopez Obrador is a danger to Mexico", were eventually banned by the Federal Electoral Institute (IFE), despite claims by Mr Calderon that the move constituted censorship.
Mr Calderon's campaign was hurt by counter-accusations from Lopez Obrador that he gave contracts to a company part-owned by his brother-in-law while he was energy secretary, which Mr Calderon has strongly denied.
Roberto Madrazo - Institutional Revolutionary Party (PRI)
A former senator, deputy and governor of his native Tabasco State, Mr Madrazo, 53, was standing for the Alliance for Mexico, a coalition between the PRI and the Mexican Green Ecologist Party (PVEM).
The PRI ruled Mexico for 71 years until Vicente Fox broke its monopoly on power in 2000 and it still has an impressive party machinery. But it was badly hurt by infighting and schisms after Mr Madrazo won the presidency of the party in 2002. Mr Madrazo has pledged to create nine million jobs to prevent Mexicans from migrating to the US but generally ran a lacklustre campaign and was not expected to do well.
Patricia Mercado - Social Democrat and Peasant Alternative Party
An economics graduate, Ms Mercado, 49, is a prominent activist for civil and women's rights, who has campaigned for abortion, gay rights and the decriminalisation of marijuana.
She stood for the presidential candidate of the Social Democracy party in 2000 but lost in the primaries to Gilberto Rincon. In 2003 her party Mexico Possible failed to register in the federal elections.
Roberto Campa - New Alliance
Mr Campa, 48, is a PRI dissident who fought Mr Madrazo's nomination as the party's presidential candidate as part of a group led by the party's former Secretary-General Elba Esther Gordillo. Although he was not expected to get many votes, his candidacy highlighted the infighting that has plagued the PRI since its defeat in the 2000 elections.
Who were the frontrunners?
Mr Lopez Obrador had a lead of almost 10% over Mr Calderon until April when he started to lose ground steadily following an ill-judged jibe at President Fox and a series of negative ads linking him to Venezuela's Hugo Chavez. He was also hurt by his decision to boycott the first televised debate on 25 April.
His campaign since recovered, and he and Mr Calderon were seen as the frontrunners. Mr Madrazo was in third place.
The other two candidates barely registered with voters.
What happened at the last election?
In 2000, ex-Coca-Cola executive Vicente Fox (PAN) was elected president with 42.5% of the vote, Francisco Labastida (PRI) got 36.1% and Cuauhtemoc Cardenas (PRD) got 16.4%.
How does the voting system work?
Unlike many other leaders, Mexican presidents are elected every six years in a single round, in a first-past-the-post system. Vicente Fox, for example, won in 2000 with 43% of the vote.
About 72 million people are registered to vote, according to IFE, out of a population of 106.4 million (UN, 2005).
This is the first time that Mexicans abroad were allowed to vote and 35,746 registered to vote from the United States, out of a total of 40,854. Overseas voters could only cast a ballot for president and ballots had to be received by IFE no later than 1 July.
What about the other elections?
Voters also elected all 500 members of the Chamber of Deputies to three-year terms; 300 were elected by simple majority and the remaining 200 by proportional representation.
All 128 members of the Senate were being elected to six-year terms. Two seats in each of the 31 states and Federal District were to be decided by first-past-the-post, a third seat was given to the first runner-up and a fourth seat was filled through proportional representation from national party lists. Currently, none of the main parties have a controlling majority in either house and the new legislature is also likely to be divided.
Gubernatorial elections were held in three of Mexico's 31 states: Guanajuato, Jalisco and Morelos.
Who was tipped to win the Mexico City mayor's race?
The Mexico City mayor's race mirrored the presidential contest with five candidates were seeking the post.
According to a poll published on 21 June, the frontrunner was Marcelo Ebrard of Mr Lopez Obrador's Alliance for the Good of All, a coalition between the PRD, the Labour Party and the Convergence Party. Mr Ebrard was supported by 47% of those surveyed. His nearest rivals were Demetrio Sodi of the PAN, with 28%, and Beatriz Paredes, the Unity for the City (PRI/PVEM) candidate, with 21%.
What were the main election issues?
Mexico is a dynamic nation with the second largest population in Latin America and a diverse economy in which the oil industry plays a major role. But prosperity remains a dream for most Mexicans. Rural areas are often neglected and huge shanty towns ring the cities.
The challenge for the new president will be to continue to promote economic growth while improving the living standards of tens of millions of poor Mexicans living in the countryside and urban shanties.
Mexico's relations with the neighbouring United States are of paramount importance, and the issue of illegal immigration across the Rio Grande by Mexicans seeking economic opportunities have led to tensions between Washington and Mexico City.
Washington is keeping a wary eye on its southern neighbour and a Lopez Obrador victory would send alarm bells ringing in the White House, fearful that the victor could seek to emulate Venezuela's Hugo Chavez and challenge its regional dominance.
The new leader will also be confronted by a society where violent crime is endemic and the kidnappings rate is among the highest in the world.
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.