Austria and Germany have agreed to receive thousands of migrants due to arrive at the Hungarian border, Austria's Chancellor Werner Faymann says.
Faymann told Austria's APA news agency that he had informed Hungary's Prime Minister Viktor Orban of the decision "in consultation" with German Chancellor Angela Merkel.
He said it was motivated by "the current emergency at the Hungarian border".
Hungarian officials on Friday said they were laying on buses to ferry desperate refugees who had set off on foot for the Austrian border after being stranded for days in Budapest's main railway station.
Buses will be sent to the Keleti station in Budapest, which has been besieged by more than 2000 migrants trying to get to Austria by train.
Buses will also be sent to pick up about 600 people who broke off from the crowd at the station and started walking along a motorway to the border 160 kilometres away.
Earlier on Friday, Hungary passed harsh laws aiming to discourage migrants from crossing the border illegally, while Greece agreed to build a large reception centre for migrants.
Starting on September 15 border trespassing becomes a criminal act in Hungary, smuggling people will be punishable by 20 years in prison, and transit zones designed to funnel migrants toward registration centres on the border will be set up.
Nearly all the migrants come via the so-called Balkan route crossing Turkey, the Aegean Sea to Greece, Macedonia and Serbia, where they enter Hungary and Europe's border-free Schengen zone.
Most hope to claim asylum in Germany, but under EU law, the country that first registers a migrant processes his or her asylum claim.
A new registration centre in Piraeus near Athens, where migrants are ferried from the islands at a rate of more than 4000 a day, will be run with the help of EU organisations such as border agency Frontex.
It will identify, register and fingerprint migrants, as well as assess whether they have a genuine asylum claim.
Those who do not are to be sent back to their country of origin.