While the world nervously watches the uprising in Iran, an even more important uprising has been passing unnoticed – yet its outcome will shape your fate, and mine.

In the depths of the Amazon rainforest, the poorest people in the world have taken on the richest people in the world to defend a part of the ecosystem none of us can live without. They had nothing but wooden spears and moral force to defeat the oil companies – and, for today, they have won.

Here's the story of how it happened – and how we all need to pick up this fight. Earlier this year, Peru's right-wing President, Alan Garcia, sold the rights to explore, log and drill 70 per cent of his country's swathe of the Amazon to a slew of international oil companies. Garcia seems to see rainforest as a waste of good resources, saying of the Amazon's trees: "There are millions of hectares of timber there lying idle."

Download the new Independent Premium app Sharing the full story, not just the headlines

There was only one pesky flaw in Garcia's plan: the indigenous people who live in the Amazon. They are the first people of the Americas, subject to wave after wave of genocide since the arrival of the Conquistadors. They are weak. They have no guns. They barely have electricity. The government didn't bother to consult them: what are a bunch of Indians going to do anyway?

But the indigenous people have seen what has happened elsewhere in the Amazon when the oil companies arrive. Occidental Petroleum are facing charges in US courts of dumping an estimated nine billion barrels of toxic waste in the regions of the Amazon where they operated from 1972 to 2000. Andres Sandi Mucushua, the spiritual leader of the area known to the oil companies as Block (12A)B, said in 2007: "My people are sick and dying because of Oxy. The water in our streams is not fit to drink and we can no longer eat the fish in our rivers or the animals in our forests." The company denies liability, saying they are "aware of no credible data of negative community health impacts".

In the Ecuadorian Amazon, according to an independent report, toxic waste allegedly dumped after Chevron-Texaco's drilling has been blamed by an independent scientific investigation for 1,401 deaths, mostly of children from cancer. When the BBC investigator Greg Palast put these charges to Chevron's lawyer, he replied: "And it's the only case of cancer in the world? How many cases of children with cancer do you have in the States?... They have to prove it's our crude, [which] is absolutely impossible."

The people of the Amazon do not want to see their forests felled and their lands poisoned. And here, the need of the indigenous peoples to preserve their habitat has collided with your need to preserve your habitat. The rainforests inhale massive amounts of warming gases and keep them stored away from the atmosphere. Already, we are chopping them down so fast that it is causing 25 per cent of man-made carbon emissions every year – more than planes, trains and automobiles combined. But it is doubly destructive to cut them down to get to fossil fuels, which then cook the planet yet more. Garcia's plan was to turn the Amazon from the planet's air con into its fireplace.

Why is he doing this? He was responding to intense pressure from the US, whose new Free Trade Pact requires this "opening up", and from the International Monetary Fund, paid for by our taxes. In Peru, it has also been alleged that the ruling party, APRA, is motivated by oil bribes. Some of Garcia's associates have been caught on tape talking about how to sell off the Amazon to their cronies. The head of the parliamentary committee investigating the affair, Rep. Daniel Abugattas, says: "The government has been giving away our natural resources to the lowest bidders. This has not benefited Peru, but the administration's friends."

So the indigenous peoples acted in their own self-defence, and ours. Using their own bodies and weapons made from wood, they blockaded the rivers and roads to stop the oil companies getting anything in or out. They captured two valves of Peru's sole pipeline between the country's gas field and the coast, which could have led to fuel-rationing. Their leaders issued a statement explaining: "We will fight together with our parents and children to take care of the forest, to save the life of the equator and the entire world."

Garcia responded by sending in the military. He declared a "state of emergency" in the Amazon, suspending almost all constitutional rights. Army helicopters opened fire on the protesters with live ammunition and stun-grenades. More than a dozen were killed. But the indigenous peoples did not run away. Even though they were risking their lives, they stood their ground. One of their leaders, Davi Yanomami, said simply: "The earth has no price. It cannot be bought, or sold or exchanged. It is very important that white people, black people and indigenous peoples fight together to save the life of the forest and the earth. If we don't fight together, what will our future be?"

And then something extraordinary happened. The indigenous peoples won. The Peruvian Congress repealed the laws that allowed oil company drilling, by a margin of 82 votes to 12. Garcia was forced to apologise for his "serious errors and exaggerations". The protesters have celebrated and returned to their homes deep in the Amazon.

Of course, the oil companies will regroup and return – but this is an inspirational victory for the forces of sanity that will be hard to reverse.

Human beings need to make far more decisions like this: to leave fossil fuels in the ground, and to leave rainforests standing. In microcosm, this rumble in the jungle is the fight we all face now. Will we allow a small number of rich people to make a short-term profit from seizing and burning resources, at the expense of our collective ability to survive?

If this sounds like hyperbole, listen to Professor Jim Hansen, the world's leading climatologist, whose predictions have consistently turned out to be correct. He says: " Clearly, if we burn all fossil fuels, we will destroy the planet we know. We would set the planet on a course to the ice-free state, with a sea level 75 metres higher. Coastal disasters would occur continually. The only uncertainty is the time it would take for complete ice sheet disintegration."

Of course, fossil fools will argue that the only alternative to burning up our remaining oil and gas supplies is for us all to live like the indigenous peoples in the Amazon. But next door to Peru, you can see a very different, environmentally sane model to lift up the poor emerging – if only we will grasp it.

Ecuador is a poor country with large oil resources underneath its rainforests – but its president, Rafael Correa, is offering us the opposite of Garcia's plan. He has announced that he is willing to leave his country's largest oil reserve under the soil, if the rest of the world will match the $9.2bn in revenues it would provide.

If we don't start reaching for these alternatives, we will render this month's victory in the Amazon meaningless. The Hadley Centre in Exeter, one of the most sophisticated scientific centres for studying the impacts of global warming, has warned that if we carry on belching out greenhouse gases at the current rate, the humid Amazon will dry up and burn down – and soon.

Their study earlier this year explained" target="_blank">Their study earlier this year explained: "The Amazonian rainforest is likely to suffer catastrophic damage even with the lowest temperature rises forecast under climate change. Up to 40 per cent of the rainforest will be lost if temperature rises are restricted to C, which most climatologists regard as the least that can be expected by 2050. A 3C rise is likely to result in 75 per cent of the forest disappearing while a 4C rise, regarded as the most likely increase this century unless greenhouse gas emissions are slashed, will kill off 85 per cent of the forest." That would send gigatons of carbon into the atmosphere – making the world even more inhabitable.

There is something thrilling about the fight in the Amazon, yet also something shaming. These people had nothing, but they stood up to the oil companies. We have everything, yet too many of us sit limp and passive, filling up our tanks with stolen oil without a thought for tomorrow. The people of the Amazon have shown they are up for the fight to save our ecosystem. Are we?

Johann Hari is a writer for the Independent. To read more of his articles, click here.

j.hari@independent.co.uk