The media rewrites history every day, and in so doing, it often impedes our understanding of the present. Mexico's presidential election of a week ago is a case in point. Press reports tell us that Felipe Calderón, the outgoing president from the PAN (National Action party), "won the 2006 election by a narrow margin".

But this is not quite true, and without knowing what actually happened in 2006, it is perhaps more difficult to understand the widespread skepticism of the Mexican people toward the results of the current election. The official results show Institutional Revolutionary party (PRI) candidate Enrique Peña Nieto winning 38.2% of the vote, to 31.6% for Andrés Manuel López Obrador, of the party of the Democratic Revolution (PRD) and 25.4% for Josefina Vázquez Mota of the PAN. It does not help that the current election has been marred by widespread reports of vote-buying. From the Washington Post:

"'It was neither a clean nor fair election,' said Eduardo Huchim of the Civic Alliance, a Mexican watchdog group funded by the United Nations Development Program. "'This was bribery on a vast scale,' said Huchim, a former [Federal Electoral Institute] official. 'It was perhaps the biggest operation of vote-buying and coercion in the country's history.'"

It may not have been enough to swing the presidential race, but for those who know what actually happened in 2006, the voters' lack of faith in the results is completely understandable. The official margin of difference between Calderón and López Obrador of the PRD, who was also the PRD's nominee in the 2006 election, was 0.58%. But there were massive irregularities.

The most prominent, which was largely ignored in the international press, was the "adding-up" problem at the majority of polling places. According to Mexico's electoral procedures, each polling station gets a fixed number of blank ballots. After the vote, the number of remaining blank ballots plus the number of ballots cast are supposed to add up to the original blank ballots. For nearly half of polling places, this did not happen.

But it got worse than that: because of public pressure, the Mexican electoral authorities did two partial recounts of the vote. The second one was done for a huge sample: they recounted 9% of the ballots. But without offering any explanation, the electoral authorities refused to release the results of the recount to the public.

From 9-13 August 2006, the Mexican electoral authorities posted thousands of pages of results on the web ,which included the recounted ballot totals. It was then possible, with hundreds of hours of work, to piece together what happened in the recount and compare it to the previous results. At the Center for Economic and Policy Research (CEPR), we did this for a large random sample (14.4%) of the recounted ballots. Among these ballots, Calderón's margin of victory disappeared.

This may explain why the electoral authorities never told the public what the recount showed, and why the authorities refused to do a full recount – which would have been appropriate for such a close election with so many irregularities. A full recount could easily have reversed the result, or found the election to be completely indeterminate.

At that time, I was struck by the lack of interest in the media as to either the "adding-up" problem, or the results of the recount. Both of these results were readily available on the web. Although it was laborious to tally the recount data, any news organization with a modicum of resources could have done the work. But none was interested.

López Obrador made the mistake of claiming that the 2006 election was stolen without demanding that the recount results be released – possibly, because he didn't trust that these would be any more accurate than the original count. He did call attention to the adding-up problem, but the media ignored this and mostly portrayed him as a sore loser.

Both the 2006 and 2012 elections were manipulated in other ways. A study from the University of Texas shows that there was significant media bias against López Obrador in 2006, and that it was much more than enough to swing a close election. About 95% of broadcast TV is controlled by just two companies, Televisa and Azteca, and their hostility toward the PRD has been documented.

In the current presidential campaign, the media duopoly ran into criticism for not broadcasting nationally the first presidential debate on 6 May. After student protesters were dismissed in the media as outside agitators, a protest movement against the TV media was launched – called "Yosoy#132" ("I am #132"), after 131 of the initial protesters produced a viral video showing their student IDs (that is, to indicate that they were genuine students).

John Ackerman rightly criticized President Obama for congratulating Peña Nieto as the winner before the official results were in. This was similar to the Bush administration's efforts to aid Calderón in 2006, which began immediately after the vote. The Calderón campaign to establish his "victory" as a fait accompli was modeled after the Bush team's successful exploitation of its "home field advantage" in Florida in 2000, as chronicled in Jeffrey Toobin's excellent book, Too Close to Call.

As I have noted previously, it is not because Mexico has a rightwing electorate that it has gone against the trend of the last 14 years in Latin America. One country after another (Brazil, Venezuela, Argentina, Ecuador, Bolivia, Uruguay, Paraguay, Honduras, El Salvador, Nicaragua and others) has elected and re-elected left governments in response to Latin America's worst long-term economic failure in more than a century (1980-2000). Although the rest of the region has done better over the past decade, Mexico has not.

Some have pointed out that the other left presidents in the Americas also faced hostile, biased media, and nonetheless won. This has certainly been true in all of the above-named countries; some, such as Bolivia, have even worse media bias than Mexico. But Mexico is, as the saying goes, "so far from God and so close to the United States".

It is one thing to portray a leader of Ecuador or Bolivia as "another Hugo Chávez", as the media campaigns there and elsewhere did. These candidates mostly laughed it off. But when the media in Mexico does the same to López Obrador – as it has been doing since 2006 – it has another meaning. Mexico shares a 2,000-mile border with the United States and sends 80% of its non-oil exports north. Not to mention the 12 million Mexicans living in the United States.

Mexico's rightwing media are in a stronger position to boost an effective scare campaign. From Greece to Ireland to Mexico, that is how the elite maintains its grip on power in failing economies – not by offering hope, however tenuous, of a better future, but by spreading the fear that any attempt at a positive alternative will bring Armageddon.

So long as Mexico's right controls the TV media – and can get some extra insurance by manipulating the electoral process as needed – Mexico will have a very limited form of democracy and will also fall far short of its economic potential.

• Editor's note: the article originally stated that the 2006 "adding-up" problem applied in a majority of polling places; in fact, it did so in nearly half. This was amended at 4pm on 10 July 2012