BANGKOK (Reuters) - China and Thailand agreed on Wednesday that the first phase of a planned high-speed railway project will cost 179 billion baht ($5.15 billion), Thailand’s transport minister said, with both countries calling for closer ties following rocky negotiations.

Thailand's Transport Minister Arkhom Termpittayapaisith gestures during an interview with Reuters at the Transport Ministry in Bangkok, Thailand, February 29, 2016. REUTERS/Chaiwat Subprasom

The 873 km (542 miles) rail line will link Thailand’s border with Laos to the ports and industrial zones in Thailand’s east.

Beijing has ambitious railway plans to connect the southwestern Chinese city of Kunming to Thailand, through Laos, and Thailand wants to modernize its aging rail network.

Earlier this year China put the project cost at 560 billion baht ($16.09 billion), which Thailand said was too high.

Agreement over the project’s framework comes after months of sometimes tense negotiations, officials said.

“This project will cost 179 billion baht. This is what we agreed upon,” Thai Transport Minister Arkhom Termpittayapaisith told reporters in Bangkok after a three-day meeting between China and Thailand.

Arkhom said Thailand will bear full construction costs, while China will provide funds for technical systems.

The first phase will focus on a 250 km (155 miles) track from Bangkok to the northeastern Thai province of Nakhon Ratchasima, with construction starting in December.

“Both countries want to begin this project by the end of the year and there is limited time remaining,” said Wang Xiaotao, vice chairman of China’s National Development and Reform Commission, who was present at Wednesday’s talks in Bangkok.

Thailand’s junta has targeted infrastructure spending as a long-term fix to help boost the economy in light of weak exports and consumer confidence.

Thailand has moved closer to China and away from its traditional ally the United States, following a 2014 coup by the Thai army, through an increase in diplomatic visits and joint Thai-China military exercises.

But disagreements over details of the rail project, such as the currency of payment, threatened future negotiations. “We will have to work through any disagreements or misunderstandings,” Arkhom told Reuters.

($1 = 34.8000 baht)