"This will put in place a corridor between China and Europe," Chinese Prime Minister Li Keqiang told reporters after signing the deal in Belgrade, estimated by local media to be worth USD 1.9 billion.
"Development of this railway line will contribute to both Hungary and Serbia," he added.
Li said he was confident the project - whose cost has not been officially confirmed - would be completed within the next two years.
China hopes to turn the Greek port of Piraeus - where the Chinese shipping giant Cosco has a 35-year concession to hugely expand its two container terminals - into a new hub for trade with the continent.
Also Read
Before signing the agreement Li met with Hungarian Prime Minister Viktor Orban, as well as his counterparts from Macedonia and Serbia, Nikola Gruevski and Aleksandar Vucic, to discuss details of the project.
Infrastructure and transport were top of the agenda at the two-day talks, which also discussed wider Chinese trade and investment in the region.
Orban hailed the bullet train deal today and said "it shows that China and Europe have found the possibility to cooperate to their mutual benefit in decades to come."
The Serbian prime minister pledged to "employ the utmost efforts and energy to see it completed".
Beijing said it was interested in investing in energy, agriculture and industry as well as infrastructure projects in the 16 countries.
Chinese Commerce Minister Gao Hucheng said it could exceed USD 60 billion this year, up USD 4.9 billion on 2013.