Thousands of rain-soaked migrants stormed across Macedonia's border on Saturday as police lobbed stun grenades and beat them with batons, struggling to enforce a decree to stem their flow through the Balkans to western Europe.

Security forces managed to contain hundreds in no-man's land. But several thousand others – many of them Syrian refugees - tore through muddy fields to Macedonian territory after days spent in the open without access to shelter, food or water.

"In this Europe, animals are sleeping in beds and we sleep in the rain," said 23-year-old Syrian woman Fatima Hamido after running across the border. "I was freezing for four days in the rain, with nothing to eat."

Macedonia on Thursday declared a state of emergency and ordered its borders sealed to migrants, many of them refugees from war who have been entering from Greece at a rate of 2,000 per day en route to Hungary and Europe's borderless Schengen zone.

On Friday, riot police fired tear gas and stun grenades to drive back angry crowds, in the latest flare-up in a migration crisis that has brought ripples from the conflicts of the Middle East to Europe's shores.

Calling out the army, Macedonia said it would ration access, and allowed some 600 through overnight; they squeezed onto a dawn train north to the Serbian border.

But far more have since arrived on the Greek side, converging on a filthy, chaotic strip of frontier with little sign of an organised aid effort. Some industrious Greeks sold sandwiches and drinks to those prepared to pay. A man with a generator charged 1.5 euros to charge mobile phones.

Pakistani man Faroq Awais, 30, said: "Last night it was raining and we couldn't go anywhere inside. We were sleeping against the walls of a building but it didn't help."

UNEASY RELATIONSMany of those arriving are Syrian refugees who have come via Greek islands such as Kos. Some 50,000 hit Greek shores in July alone.

"We urge the (Macedonian) government to start opening the border again and prioritising the most vulnerable, such as women, children and sick people," Alexandra Krause, a senior protection officer with the United Nations refugee agency, UNHCR, said earlier on Saturday.

"There are around 3,000 people here and the numbers are rising," Krause told Reuters. "People are exhausted. It has rained all night and they had no shelter."

For many Macedonians, the crisis has echoes of 1999, when hundreds of thousands of ethnic Albanians took shelter in refugee camps on Macedonia's northern border during a war in neighbouring Kosovo, then a province of Serbia.

Critics say those who cross from Greece do not linger long in Macedonia and accuse Skopje of failing to respond quickly enough to the rising numbers by opening reception centres on the border.

Conservative Prime Minister Nikola Gruevski, on the ropes for much of 2015 over a surveillance scandal, faces an early election next April and may win praise at home for taking a hard line on Greece for allowing the migrants through. Macedonian state media have criticised Athens for chartering ships to take migrants from Greek islands to the mainland.

Athens and Skopje have an uneasy relationship, rooted in a dispute over Macedonia's name since it declared independence from Yugoslavia in 1991. The row has effectively blocked Macedonia's integration with the European Union and NATO.