The Argentinian government's decision to renationalise the oil and gas company YPF has been greeted with howls of outrage, threats, forecasts of rage and ruin, and a rude bit of name-calling in the international press. We have heard all this before.

When the government defaulted on its debt at the end of 2001 and then devalued its currency a few weeks later, it was all doom-mongering in the media. The devaluation would cause inflation to spin out of control, the country would face balance of payments crises from not being able to borrow, the economy would spiral downward into deeper recession. Then, between 2002 and 2011, Argentina's real GDP grew by about 90%, the fastest in the hemisphere. Employment is now at record levels, and both poverty and extreme poverty have been reduced by two-thirds. Social spending, adjusted for inflation, has nearly tripled. All this is probably why Cristina Kirchner was re-elected last October in a landslide victory.

Of course this success story is rarely told, mostly because it involved reversing many of the failed neoliberal policies – that were backed by Washington and its International Monetary Fund – that brought the country to ruin in its worst recession of 1998-2002. Now the government is reversing another failed neoliberal policy of the 1990s: the privatisation of its oil and gas industry, which should never have happened in the first place.

There are sound reasons for this move, and the government will most likely be proved right once again. Repsol, the Spanish oil company that currently owns 57% of Argentina's YPF, hasn't produced enough to keep up with Argentina's rapidly growing economy. From 2004 to 2011, Argentina's oil production has actually declined by almost 20% and gas by 13%, with YPF accounting for much of this. And the company's proven reserves of oil and gas have also fallen substantially over the past few years.

The lagging production is not only a problem for meeting the needs of consumers and businesses, it is also a serious macroeconomic problem. The shortfall in oil and gas production has led to a rapid rise in imports. In 2011 these doubled from the previous year to $9.4bn, thus cancelling out a large part of Argentina's trade surplus. A favourable balance of trade has been very important to Argentina since its default in 2001. Because the government is mostly shut out of borrowing from international financial markets, it needs to be careful about having enough foreign exchange to avoid a balance of payments crisis. This is another reason that it can no longer afford to leave energy production and management to the private sector.

So why the outrage against Argentina's decision to take – through a forced purchase – a controlling interest in what for most of the enterprise's history was the national oil company? Mexico nationalised its oil in 1938, and, like a number of Opec countries, doesn't even allow foreign investment in oil. Most of the world's oil and gas producers, from Saudi Arabia to Norway, have state-owned companies. The privatisations of oil and gas in the 1990s were an aberration; neoliberalism gone wild. Even when Brazil privatised $100bn of state enterprises in the 1990s, the government kept majority control over energy corporation Petrobras.

As Latin America has achieved its "second independence" over the past decade-and-a-half, sovereign control over energy resources has been an important part of the region's economic comeback. Bolivia renationalised its hydrocarbons industry in 2006, and increased hydrocarbon revenue from less than 10% to more than 20% of GDP (the difference would be about two-thirds of current government revenue in the US). Ecuador under Rafael Correa greatly increased its control over oil and its share of private companies' production.

So Argentina is catching up with its neighbours and the world, and reversing past mistakes in this area. As for their detractors, they are in a weak position to be throwing stones. The ratings agencies threatening to downgrade Argentina – should anyone take them seriously after they gave AAA ratings to worthless mortgage-backed junk during the housing bubble, and then pretended that the US government could actually default? And as for the threats from the European Union and the rightwing government of Spain – what have they done right lately, with Europe caught in its second recession in three years, nearly halfway through a lost decade, and with 24% unemployment in Spain?

It is interesting that Argentina has had such remarkable economic success over the past nine years while receiving very little foreign direct investment, and being mostly shunned by international financial markets. According to most of the business press, these are the two most important constituencies that any government should make sure to please. But the Argentinian government has had other priorities. Maybe that's another reason why Argentina gets so much flak.

• Follow Comment is free on Twitter @commentisfree