Macedonia amended its asylum law on June 18 to allow migrants entering the country illegally to avoid jail if they leave within three days.
The move follows a series of fatal accidents involving migrants traveling through Macedonia.
Macedonia has become a major transit route for thousands of Middle Eastern and African refugees and migrants who cross over from Greece and then continue into Serbia.
At least 25 have been killed by trains since January as they walked on railway tracks. Many others are robbed by criminal gangs.
The new law approved by parliament will come into effect in eight days, and follows pressure from human rights groups.
It allows migrants to apply for temporary asylum at the border or the nearest police station. That will allow them to travel legally through the country for three days.
Interior Minister Mitko Cavkov told lawmakers that the number of migrants has tripled since last year -- with 2,000 to 3,000 people trying to enter every day -- and criticized neighboring Greece for letting thousands flow clandestinely across the border.
Greece is a major destination for refugees and migrants entering Europe, most of whom cross, in turn, from neighboring Turkey.