SAO PAULO, Aug 24 (Reuters) - Brazil is set to overtake the U.S. this year as the world's top corn exporter, reflecting both a bumper harvest and logistical breakthroughs such as the consolidation of northern export routes, which are boosting the competitiveness of the South American grains powerhouse.

Corn exports through Brazil's northern ports, which use the waterways of the Amazon River basin to ship grains globally, are on track to beat volumes via the most traditional port of Santos for a third consecutive year, according to a Reuters analysis of grain shipping data.

The shift underscores how Brazil, which churns out three corn crops per year and still has huge expanses of under-used farm land, is finally overcoming some of the infrastructure bottlenecks that have long made it hard to get its bountiful harvests to global markets.

That and a new supply deal with China announced last year suggest Brazil may be opening a longer era of supremacy over U.S. corn exports, unlike the last time the Brazilians briefly grabbed the global corn crown during North America's drought-hit 2012/13 season.

The improved export capacity helped Brazil to fill gaps in the global corn market amid disruptions from the war in major grain exporter Ukraine and trade tensions between the U.S. and China.

"We celebrated a lot... when (corn export) volumes via northern ports equaled Santos," said Sergio Mendes, head of Brazilian grain exporter group Anec. "By using northern ports... you are saving 20 reais ($4.12) per ton (of corn)."

Major new investments in Brazil have begun to ease several chokepoints and bring down logistics costs sharply, helping to undercut U.S. farmers.

Northern export routes in particular have benefited from a 2013 law that encouraged grains traders such as Cargill and Bunge, and barge operator Hidrovias do Brasil, to build out new private-use port terminals (TUPs).

Their transshipment stations on the Tapajos and Madeira rivers have linked up the heart of Brazilian farm country and up-and-coming Amazonian ports such as Itacoatiara, Santarem and Barcarena.

The Tegram grain terminal at Itaqui, built and operated by foreign and Brazilian grain merchants including Louis Dreyfus Commodities and Amaggi, boosted its grain export volumes by 306% in eight years to more than 13 million tons in 2022, according to data provided by the firms.

The TUP legal framework, unlike a traditional concession for a limited period, has unlocked a wave of long-term port investments in Brazil. Some 39 billion reais ($8.0 billion) have poured into building and expanding 112 new private-use terminals under the new law, according to a 2020 study by Brazil's TCU federal audit court.

Brazil's farm industry, however, is not past all of its logistical woes. On-farm storage capacity still pales next to rival grain powers like Canada, the U.S. and Argentina.

In the No. 1 grains state of Mato Grosso, the storage gap had surged to 46 million metric tons, according to state government data through 2021, after the annual corn harvest tripled in a decade to over 90 million tons, faster than new silos could be built.

A lack of storage space means Brazilian farmers are forced to quickly sell their harvests or pile their corn outside warehouses and hope for good weather. As a result, much of the Brazil harvest crowds onto the roads during a narrow seasonal window, which can make for expensive traffic jams.

CHEAPER ROUTE TO CHINA

The new export capacity has helped grains shipped from Brazil's northern ports to compete on logistics costs with U.S. farmers.

Shipping a ton of soybeans in 2008 from Iowa to Shanghai was 77% of the price of using Brazil's northern ports, but by March 2023 it was 5% more expensive shipping it from the U.S., according to U.S. Department of Agriculture and Brazil's ESALQ-LOG data. For corn, freight values are very similar, says Thiago Pera, logistics research coordinator at ESALQ-LOG.

The Amazon basin has also become competitive with the southeastern port of Santos, long the powerhouse of Brazilian grains exports. Some 37% of Brazil's total corn exports flowed through Barcarena, Itaqui, Itacoatiara and Santarem ports in the first half of 2023, according to Brazil's crop agency Conab. Just 24% flowed through Santos.

By comparison, Santos exported almost three times more corn than those four northern ports in 2015, before heavy investments expanded port capacity in the Amazon region.

"The greater share of shipments through northern ports reflects cheaper freight costs compared to routes to the ports in the south and southeast," said Thome Guth, a Conab official.

Conab forecasts Brazil's 2023 total corn output at nearly 130 million metric tons, the highest ever, and exports reaching 50 million metric tons for the first time.

Corn futures in Chicago have fallen from a 10-year high in April 2022 to a two-and-a-half-year low this month, in part due to ample supplies from Brazil.

Brazil's surging export infrastructure shows little sign of letting up, even though lower prices may discourage farmers from expanding plantings as rapidly.

Chinese state-owned trader COFCO is now building a major new grains terminal at Santos after getting a 25-year license to operate a unit with capacity for 14 million tons. Shipments from COFCO's STS11 terminal are scheduled to begin in 2026.

A highway license issued two years ago has also modernized a key Amazonian grain corridor stretching over 1,000 kilometers (625 miles) from Mato Grosso to ports in Para state, known as BR-163.

For years, caravans of grain trucks would get stuck regularly in deep mud on that road when they got caught in the rain on their way to northern ports.

Major rail projects still face an array of bureaucratic obstacles, but a few have gotten off the drawing board.

Brazil's largest rail company Rumo just finished an investment of 4 billion reais on the Ferrovia Norte Sul, started in 2019. The line connects Santos port to farm states Tocantins, Goias, Minas Gerais and Mato Grosso, reinforcing another key route to get Brazilian harvests to global markets. ($1 = 4.8769 reais)

(Reporting by Ana Mano; Editing by Brad Haynes and Marguerita Choy)