Syrians, Afghans and Iraqis fleeing conflict are flowing largely unimpeded across Balkan borders having landed by boat in Greece from Turkey.
But for the past two weeks, countries on the route including Macedonia have begun turning back migrants of other nationalities, leading to a chaotic buildup at the Macedonian-Greek border and days of protests by Iranians, Pakistanis, Moroccans and others.
Two days ago, protesters tried to storm police lines, breaking through a flimsy barrier into Macedonia, an impoverished former Yugoslav republic.
A government spokesman said the aim of the new fence was "to direct the inflow of people towards the controlled points for their registration and humane treatment."
"We would like to underline that the border will remain open," said spokesman Aleksandar Gjorgjiev. "We will allow passage for the people who come from war-affected regions as we have done thus far."
European Union member Hungary in September and October sealed its own southern border to migrants, calling them a threat to the security, prosperity and "Christian values" of Europe.
That diverted them into Croatia and Slovenia en route mostly to Germany, which is struggling to cope. Germany expects roughly 1 million refugees and migrants to arrive this year alone.
Follow us on Twitter: @CNBCWorld