Cambodian premier Hun Sen and his Thai counterpart Prayut Chan-O-Cha witnessed a signing ceremony at a Thai border post before riding together to the Cambodian town of Poipet on a train donated by Thailand.
The pair -- with Prayut dressed in a bright yellow shirt -- stepped from the carriage in Poipet with their clasped hands held high to the cheers of waiting crowds, waving flags of both countries.
Hun Sen described their journey as "historic" and thanked Thailand for its efforts "to reconnect the railway between Cambodia and Thailand."
The railway would also better link his country to other southeast Asian neighbours and boost economy and trade, he added.
Bilateral trade between Thailand and Cambodia currently stands at $6 billion.
Cambodia last year re-opened the final stretch of a 370-kilometer (230-mile) railway running from the capital, Phnom Penh, to the Thai border.
The Asian Development Bank bankrolled the reconstruction of the link to the tune of $13 million.
Much of Cambodia's railways - built by the French in colonial times - were damaged by the years of bitter conflict that engulfed the country during the Cold War era.
The 48-kilometer (30-mile) section of track near Poipet was destroyed in 1973 while the rest of the track to Phnom Penh had been suspended for over a decade due to its poor condition.
The Southeast Asian country has more than 600 kilometers (375 miles) of track extending from its northern border with Thailand to the southern coast.