The accident happened at a remote location near the central Macedonian city of Veles on Thursday night.
Local media said migrants often used the rail track as a guide while heading north after landing in Greece.
EU leaders have agreed plans to curb an influx of migrants as many cross the Mediterranean aboard overcrowded boats.
They held a summit in Brussels on Thursday after more than 750 people died on a boat crossing to Italy from Libya on Sunday.
Difficult terrain
Reports say the migrants killed in Macedonia were part of a group of about 50 people, mainly from Somalia and Afghanistan.
Rescue efforts were hampered by difficult terrain, with the site of the accident accessible only by foot or railway.
The train driver said he had spotted the group on the tracks little more than 50m (165ft) ahead and had sounded an alarm in an attempt to disperse them, but some of the migrants had not been able to move from the tracks in time, MIA news agency reported.
The train was said to be travelling to the Serbian capital Belgrade from the Greek city of Thessaloniki.
People fleeing war, poverty and repression in the Middle East and Africa are increasingly turning to the Balkans as a land route to western Europe, deemed safer than crossing from Libya to Italy by boat.
Many instead cross from Turkey to Greece and travel via Macedonia and Serbia and Bulgaria to Western Europe.
Source BBC.