The deal gives Tereos, the world's second-largest sugar maker, a rail link to the port from its inland production centre in the world's top sugar producer and exporter Brazil.

Under the agreement, Tereos will invest 145 million reais ($38 million) and VLI will invest 60 million reais over two years, the companies said in a joint statement.

One of the two new warehouses will be in Guara, close to Tereos' production hub, with storage capacity of 80,000 tonnes, while the second will be at VLI's Tiplam terminal in Latin America's largest port in Santos with 114,000 tonnes capacity.

Both warehouses, which are due to be completed by the end of 2019, will be operated by VLI.

The deal also includes a long-term deal to transport 1 million tonnes of raw sugar per year from Guara to Tiplam.

The 2.2 billion reais Tiplam terminal started operations with two berths last year, enabling VLI to handle 4.6 million tonnes of sugar in 2017, double the 2013 volume, the companies said.

Tereos Commodities traded about 1.4 million tonnes of sugar globally in fiscal 2017/2018, 40 percent up on a year earlier.

Tereos regained a 100 percent ownership of its Brazil-based mills last year after buying the remaining 45 percent stake it did not already own in its venture with state-controlled oil company Petrobras for $202 million.

VLI's main shareholders include Brazilian mining company Vale, Japanese commodities trader Mitsui & Co Ltd and Canadian asset manager Brookfield.

($1 = 3.7973 reais)

(Reporting by Sybille de La Hamaide; Editing by Edmund Blair)