The vote was the first since Vicente Fox's stunning victory six years ago ended 71 years of rule by the Institutional Revolutionary Party, or PRI. It will determine whether Mexico becomes the latest Latin American country to move to the left.
Polls predict a close race between conservative Felipe Calderon, 43, of Fox's National Action Party, and leftist Andres Manuel Lopez Obrador, 52, a former Mexico City mayor. The PRI's Roberto Madrazo, 53, was running a distant third, ahead of two other minor candidates.
Five governors and both houses of Congress will also be elected.
Officials hoped to announce a new president three hours after the last poll closed, based on a quick count. But they cautioned they would wait if neither candidate had a strong enough lead. Some worried there might be violence if the decision wasn't clear.
After a six-month campaign marked by mudslinging and a polarized electorate, Mexicans greeted the vote with relief. "Finally, a decision!" read the front-page headline in Reforma newspaper.
Many polling stations were late in setting up, forcing voters to wait more than an hour to cast their ballot. Carolina Nougue, 35, a perfume factory quality control manager, sat frustrated outside a poll tucked between two massive shopping malls in an upscale Mexico City neighborhood.
"It's a bad sign," she said.
Nougue was a liberal who was reluctantly casting her vote for Calderon, an effort to keep Lopez Obrador out of office. She believed the leftist candidate would govern like radical Venezuelan President Hugo Chavez, and she was turned off by his pledge to put the poor first.
"The division isn't between the rich and the poor," she said. "It's between the ignorant people and those who think."
Thousands of Mexican expatriates who did not get absentee ballots for their homeland's presidential election caravanned to border towns Sunday to cast their votes in a race many believe will impact their lives in the United States.
Leaving in the wee hours Sunday morning, dozens boarded buses in Los Angeles and other Southern California cities to head to Tijuana.
But others, in this country illegally, did not dare cross the border to vote in person. That same fear kept many from traveling to Mexico over the last year to apply for voter card, necessary for either an expatriate ballot or Election Day voting.
The estimated 10 million Mexicans living in the United States were allowed to vote from abroad for the first time. Because of that and other obstacles, the potentially powerful expatriate voting bloc likely will have little impact on the tight presidential, Of the estimated 4.2 million registered Mexican voters living abroad, about 41,000, or 1 percent, requested absentee ballots.
Maria Salome Rodriguez, a 38-year-old farm worker, drove eight hours with her husband from Fresno to cast a vote at a special polling booth outside Tijuana's airport. They made the trip to the border after their applications for absentee ballots were rejected because they wrote down the wrong address.
"We want to vote so Mexico can improve and offer jobs to people here, because even though we're far away, our heart is still with our homeland," Rodriguez said.
In the eastern Mexico City slum of Nezahualcoyotl, polls were delayed by flooding from a powerful hail storm the night before. Juana Velasquez, a 63-year-old story teller, and other residents, had to spend the morning bailing water from their homes before voting.
"Every year, it's the same. You just vote for someone who doesn't do anything," said Velasquez, who was casting a protest vote for Roberto Campa, of the minor New Alliance Party.
Voting was peaceful, despite fears of violence that plagued the campaign. Zapatista leader Subcomandante Marcos, who rejected the main candidates and declared an "Alternative Campaign," marched with hundreds of supporters down Mexico City's Reforma Avenue.
Early riser Lopez Obrador, dressed in a brown leather jacket, was the first candidate to cast his ballot, waiting nearly an hour before volunteers were ready.
"We did our part," said Lopez Obrador, the candidate of the Democratic Revolution Party. "We are going to wait to see what the people of Mexico decide."
During his campaign, he accused Calderon of catering to the rich and promised that he would govern for Mexico's 50 million poor. Many followed his message like a religion, crowning him with flowers at rallies and plastering their cars with his optimistic slogan: "Smile. We are going to win."
Calderon has warned that Lopez Obrador's proposals, including government handouts for the elderly and poor, will bankrupt the nation.
Wearing a suit and tie, he showed his palm before voting in Mexico City, a reference to his "clean hands" campaign slogan.
"It has been a tense, competitive campaign," he said, adding: "Tomorrow, we have to start a new era of reconciliation."
Casting his ballot in his home city of Villahermosa on the oil-rich Gulf coast, Madrazo said he was sure he would win, despite trailing third in the polls. "We ask all the candidates to respect the results," he said.
Madrazo painted himself as the alternate to the "radical left and intolerant right." But many questioned how long his party, which suffered infighting and defections, would survive past the election.
Mexican law limits presidents to one term, and Fox plans to retire to his ranch in December.
On Sunday — six years to the day after his historic victory and his 64th birthday — he gave an ink-stained thumbs up to prove he had voted and said afterward: "I know that there are no Mexicans who want to go against democracy."
All three candidates promised to strengthen relations with the United States while opposing increased border security measures unpopular in Mexico.
Here are the positions of the three main candidates in Mexico's presidential election on issues of importance to the United States:
TRADE AND ECONOMY