With 97.70 percent of the votes counted, Felipe Calderon was 0.01 percentage points ahead of leftist Andres Manuel Lopez Obrador.
Mr Calderon had 35.60 percent to his rival's 35.59 percent in the partial count.
Mr Calderon’s supporters who had taken to the streets in celebration earlier erupted in cheers, convinced the presidency will go to him.
The conservative former energy minister had been shown taking a slender lead in the initial vote count conducted after the July 2 election.
