On the northernmost tip of South America, a train chugs across the desert past Indians with painted faces while gun-toting guards squint across the barren landscape, on the lookout for outlaws.

This tableau might seem straight out of a Western, but it is 21st-century life in a remote corner of Colombia, and it paints the nation's economic future, because the train is carrying coal, on track to replace oil as Colombia's No. 1 export.

In a country beset by rebel violence, the coal is moved under super-tight security by rail from Cerrejon, the world's biggest open-pit export coal mine, to Puerto Bolivar, the largest coal terminal in the Americas, where freighters will carry it to Europe and the United States. Guard towers, many manned by privately hired Wayuu Indians, are perched about every two-thirds of a mile along the most vulnerable stretch of the 93-mile railway. Guards also ride alongside the track on souped-up motorcycles.

After nightfall, a train car outfitted with a thermal-imaging device scans for saboteurs.

The vigilance underscores coal's importance to the Colombian economy. Colombia is the world's fifth-largest coal exporter -- after Australia, China, Indonesia and South Africa -- with revenue of $1.7 billion in 2004.

Cerrejon, which accounts for as much as 60 percent of Colombia's coal exports, is owned by foreign mining giants BHP Billiton, Anglo American and Glencore International. The mine expects to pay $320.3 million in taxes and $118 million in royalties for 2005; it also finances schools, health clinics and other works.

From Cerrejon's mine, where 24.9 million tons of coal were extracted last year, the railway heads north into the arid Guajira peninsula, which juts into the Caribbean at South America's northern tip. The peninsula has few roads and little other infrastructure and is inhabited mostly by the impoverished Wayuu, some of whom blacken their faces with the powder of dried mushrooms as a sunblock.

The railway, for the first 25 miles, crosses a verdant landscape. This is the area known as the red zone, where rebel attacks are most likely, said Eliecer Avila, a Cerrejon security official.

"The Venezuelan border is just three hours away on horseback, and there is lots of jungle for cover. This is the riskiest area," Avila said. He added that the rebels -- who run extortion rackets and attack those who don't pay -- often use neighboring Venezuela as a sanctuary after carrying out raids.

For its remaining 68 miles, the railway is safer because the countryside turns into a desert, with little cover available.

While oil pipelines in Colombia have been bombed by rebels hundreds of times since 2000, Cerrejon's coal trains have been attacked just three times in the same period, the last being in September 2003, when the guerrillas derailed 17 cars with dynamite. No one has been killed in the attacks.

Cerrejon hopes to extract a record 25.7 million tons this year. Its locomotives, pulling up to 120 cars, make a half-dozen trips each day from mine to port, transporting about 80,000 tons every 24 hours.

"In six months, we move as much earth as was moved in the construction of the Panama Canal," said Nancy Murgas, a Cerrejon spokeswoman.

But unlike the digging of the 50-mile canal, the removal of coal and the topsoil -- which is set aside for rehabilitating the land after extraction is completed -- is all done by massive machines. Boarding one of the earthmovers, whose shovel can hold 80 tons in a single scoop, is like climbing aboard a ship. The tires alone are twice a man's height.

Yet even they look tiny against the gigantic backdrop of Cerrejon. Of seven pits spread over 170,500 acres of coal deposits, one is 2 miles long, 11/4 miles across and up to 800 feet deep.

Overall, coal is gaining on oil as Colombia's top export, as known oil reserves begin to drain. Colombia, Latin America's fifth-largest oil producer, pumps around 530,000 barrels a day, compared to 830,000 in 1999. Experts say Colombia could become a net importer of oil by next year unless new reserves are discovered.

On the other hand, Colombia has estimated reserves of about 8 billion tons of coal, much of it high-grade and used to fire electrical generating plants around the world, that will last into the foreseeable future.

Colombian coal is shipped out of Puerto Bolivar on the northernmost tip of South America. Colombia's oil reserves are starting to dwindle but it has estimated reserves of about 8 billion tons of coal.An indigenous Wayuu girl attends class at a school financed by the Cerrejon coal mine, which is owned by a foreign consortium. The tribe helps protect coal trains, which run through a region known for rebel attacks.Trucks carry coal from the Cerrejon coal mine. The largest of its seven pits is 2 miles long and11/4 miles across.