DJIBOUTI — The 10:24 a.m. train out of Djibouti’s capital drew some of the biggest names in the Horn of Africa last month. Serenaded by a chorus of tribal singers, the crush of African leaders, European diplomats and pop icons climbed the stairs of the newly built train station and merrily jostled their way into the pristine, air-conditioned carriages making their inaugural run.

“It is indeed a historic moment, a pride for our nations and peoples,” said Hailemariam Desalegn, the prime minister of Ethiopia, shortly before the train — the first electric transnational railway in Africa — headed toward Addis Ababa, the Ethiopian capital. “This line will change the social and economic landscape of our two countries.”

But perhaps the biggest star of the day was China, which designed the system, supplied the trains and imported hundreds of engineers for the six years it took to plan and build the 466-mile line. And the $4 billion cost? Chinese banks provided nearly all the financing.

Having constructed one of the world’s most extensive and modern rail networks at home, China is taking its prodigious resources and expertise global. Chinese-built subway cars will soon appear in Chicago and Boston, Beijing is building a $5 billion high-speed rail line in Indonesia, and the Chinese government recently christened new rail freight service between London and Beijing. Another ambitious system in the works, the 2,400-mile Pan-Asia Railway Network, would link China to Laos, Thailand and Singapore.