Enrique Pena Nieto, the youthful candidate of the party that governed Mexico for decades, claimed victory in the country's presidential election.
The candidate for the Institutional Revolutionary Party (PRI) cited the first official results announced by the independent Federal Electoral Institute (IFE) as proof that he won.
The results showed Pena Nieto with 38 percent of the vote against 31-32 percent for his nearest rival, leftist Andres Manuel Lopez Obrador from the Party of the Democratic Revolution (PRD).
The margin was not as wide as in exit polls, but was difficult to overcome.
Pena Nieto, 45, entered the PRI headquarters in Mexico City to a hero's welcome soon after the results were announced.
"Presidente! Presidente!" the crowd chanted.
"The day of voting has ended. The country now demands ... the unity of all Mexicans," he said, then thanked the other candidates by name for what he said was their contribution to democracy. He also thanked outgoing President Alvaro Calderon by name "for his democratic vocation."
IFE president Leondardo Valdes said the first official results were based on returns from 7,500 polling stations and have a 0.5 percent margin of error.
"More votes were cast in this election than in any other election in Mexico's history," Valdes said.
Lopez Obrador however refused to concede.
"We are going to wait until we have definitive results," he said. "We are not going to act in an irresponsible way. At the right time we will inform the people of Mexico."
In 2006, when Lopez Obrador ran for president and lost by less than one percent, he organized protests that paralyzed Mexico City for more than a month, then swore in as the "legitimate" president and even appointed a cabinet.
Far behind in the IFE results was Josefina Vazquez Mota from Calderon's conservative National Action Party (PAN) with 25 percent. "I recognize that the tendencies up to now do not favor me," Vazquez Mota told a crowd of loyalists in a de facto concession speech.
Pena Nieto's win marks a comeback for the center-left PRI, which ruled for seven decades until 2000 through a mixture of patronage and selective repression.
The dapper, perfectly-coifed is an ex-governor of the populous state of Mexico, located just west of the capital.
He is married to glamorous telenovela star Angelica Rivera, and benefited from his family connections with powerful old guard PRI politicos as well as a stellar media team that carefully managed his appearances.
Calderon's PAN has been hemorrhaging support due to the brutal drug violence that has killed more than 50,000 people since he came to power in 2006.
His military crackdown on the cartels has turned parts of the country into war zones.
The economy grew under the PAN, but so did poverty: 47 percent of Mexico's 112 million residents are poor, according to government figures. Mexico may be Latin America's second biggest economy after Brazil, but there are nearly 15 million more poor people since the PRI left power, figures show. Poverty ranks second among voter concerns after insecurity.
Election officials worked hard to convince skeptics that the ballot will be clean but faced a raft of complaints in the lead-up to the vote.
The PAN accused the PRI of handing out more than 9,900 gift cards to influence voters. Election officials pledged an investigation but refused to freeze a bank account linked to the cards containing some $5.2 million.
The PRI in turn accused the PRD and PAN of attempting to sway voters by handing out bags of food and building materials. And the PRD alleged "very serious irregularities" including PRI fuel charge cards.
Nearly one million Mexicans -- including election workers, volunteer citizens and party representatives -- as well as 700 international observers were at polling stations overseeing the vote.
Also up for grabs are 500 seats in the Chamber of Deputies, where members serve for three years; 128 seats in the Senate, which has six-year terms; and various mayoralties and governorships.
Security is a top concern in Mexico. Kidnappings, drug hits and gang warfare have turned some areas into virtual war zones.
Extra army patrols were deployed in especially dangerous regions like the northern border town of Nuevo Laredo, where a car bomb -- a rarity in Mexico -- detonated Friday in front of the mayor's office.