The agreement was witnessed by East African presidents Yoweri Museveni of Uganda, Paul Kagame of Rwanda and Salva Kiir of South Sudan as the line will be extended from Nairobi to the Uganda capital Kampala, and later to Rwanda's capital Kigali and Juba in South Sudan.
The initial Mombasa - Nairobi section will be constructed by China Roads and Bridge Construction at a cost of $US 3.6bn, which is considerably less than the $US 5.2bn estimated earlier by a Kenyan parliamentary committee.
The Chinese contractor was appointed without competitive bidding after Kenya agreed to this as a condition for Chinese funding. China will finance 90% of the project while Kenya will provide the remaining 10%. China will provide a $US 1.6bn commercial loan and $US 1.63bn as a concessionary facility.
Work on the project will start in October and is due to be completed in March 2018.
Li's visit to Kenya was the final leg of a four-country African tour which included Ethiopia, Angola and Nigeria. During his Nigerian visit, Li also signed a framework agreement involving China Civil Engineering Construction Corporation for the construction of a $US 13.1bn railway in southern Nigeria linking Lagos with Port Harcourt. The 600km line would have a maximum speed of 120km/h and 12 stations.