When the next president takes office, one of his most daunting tasks will be breaking the diplomatic wall office that has formed between Mexico and its neighbour to the north.
From the Mexican perspective, an indifferent White House and antagonism from US groups battling illegal immigration has turned the relationship strained and chilly.
"Relations with the US look like they are going sour," said Sydney Weintraub, a Mexico expert at the Washington-based International Center for Strategic Studies.
Mexicans are insulted that Republican lawmakers have focused on sealing the border while stalling a Senate proposal that would provide a path to citizenship for millions of illegal immigrants and their families. Mexico also stings from US criticism of its failure to control drug-related violence.
Washington, meanwhile, have not forgotten Mexico's opposition to the Iraq war, and insists that its southern neighbour is not doing enough to stem the tide of illegal migrants north, an issue that will remain front-and-center on the diplomatic agenda in what also is an election year north of the border.
"Immigration will remain an ever-larger and tougher bone of contention," said George Grayson of the College of William & Mary in Virginia.
Who will tackle that issue from the Mexican side of the border was dramatically unclear late Sunday night. Election officials said the race was too close to call and results would wait for a formal count starting Wednesday.
With his eyes on an immigration accord, outgoing President Vicente Fox made it his mission during his six-year term to maintain a close relationship with the United States and his good friend President George W Bush -- in spite of criticism at home that he was becoming Washington's puppet. Many Mexicans say his intimate ties won him few concrete benefits.
"The sobering effect of these experiences suggests that Mexico's next president will move the country away from Fox's tight embrace of the United States," wrote Pamela K Starr in a report for the New York think tank Council on Foreign Relations.
Leftist candidate Andres Manuel Lopez Obrador has promised to do just that. He says as president he would not "be the lackey of any foreign government" -- a statement analysts say was a direct reference to the United States -- and would return to Mexico's traditional non-interventionist foreign policy.
Felipe Calderon, the candidate of Fox's conservative party, would likely continue "close cooperation with the United States, but without a warm public embrace," Starr wrote.
Lopez Obrador also has promised to defy certain clauses of the North American Free Trade Agreement. He wants to renegotiate the agricultural sections of the accord, and says he won't allow the elimination of tariffs on US corn and beans scheduled for 2008.
Yet he also has said he would maintain a relationship "of respect and cooperation with the United States," and analysts agree he is unlikely to sign on to the harsh anti-US rhetoric of Venezuela's Hugo Chavez or Bolivia's Evo Morales, given the economic and social importance of cross-border ties.