Peru's President Alan Garcia and his Bolivian counterpart, Evo Morales, have signed a deal to allow landlocked Bolivia to build its own Pacific port.
The accord expands a 1992 deal that gave a small plot of land on Peru's coastline to Bolivia.
The accord would allow Bolivia to have greater access to global markets, Mr Morales said.
Chile defeated Peru and Bolivia in a 19th Century war, and since then Bolivia has had no access to the sea.
"It is unjust that Bolivia has no sovereign outlet to the ocean," President Garcia during his meeting this week with President Morales in the southern Peruvian port of Ilo.
Mr Morales said the deal would "open the door for Bolivians to have an international port, to use the ocean for global trade and for Bolivian products to have better access to global markets".
The meeting marked a distinct warming of relations between the two men who have had strained political relations.
Bolivia, which is a big exporter of metals, including silver, tin and zinc, currently exports most minerals through Chile.
The deal expands an earlier agreement that granted a small section of coast to Bolivia but prohibited Bolivia from owning property in the zone.
Under it, Bolivia will be able to use the 3.58 sq km (1.38 sq miles) build a dock and operate a free-trade zone. It will also allow Bolivia to operate an annex of its navy school, which to date has been limited to rivers and Lake Titicaca.
In the 1879-84 War of the Pacific, Chile won control of mineral-rich land once held by Peru and Bolivia, and the outcome left Bolivia landlocked.
Bolivia has regularly called on Chile to give it a corridor to the Pacific.