Denmark introduced temporary controls along its border with Germany on Monday, Danish Prime Minister Lars Lokke Rasmussen said, hours after Sweden introduced ID controls for travellers from Denmark.
Police will conduct "spot checks," he added. "It does not mean that everyone from Germany will be checked. Police will not ask everyone to ask to show their passports."
"The measures will initially be in place for 10 days," Rasmussen told a news conference.
Since early September, 91,000 people have passed through Denmark from Germany, of whom 13,000 applied for asylum in Denmark. The others continued to Norway and Sweden, he said.
There is a risk that people will be stranded in Denmark if they can't continue to Sweden, he added.
"We want to prevent such a development," he said, adding he had informed German Chancellor Angela Merkel and the head of the German state of Schleswig-Holstein, which borders Denmark.
Rasmussen declined to comment on Merkel's reaction.
Identity checks went into effect at midnight Monday for travellers from Denmark to Sweden as part of measures to reduce the flow of migrants into Sweden.
Passengers boarding trains, ferries or buses bound for Sweden have to show a passport or other form of valid ID card to be allowed onboard under the new rules. Transport companies are responsible for conducting the checks.
Similar checks between the two Nordic neighbours have not been in place since the 1950s.
Danish train operator DSB said it has set up 34 checkpoints at the Kastrup train station that serves Copenhagen Airport, and is the last train stop before the Swedish border.
The checks are conducted after passengers change trains before continuing over the Oresund rail and road bridge that connects Sweden to Denmark.
"We are checking people's ID and have done so since midnight (2300 GMT). We have not experienced any major queues or challenges," DSB spokesman Tony Bispeskov told Danish news agency Ritzau.
DSB said passengers should be prepared for delays.
Swedish television reported that eight people had during the first seven hours been stopped at Kastrup - of whom four were Afghan nationals who lacked ID papers - and returned to Copenhagen's Central Station.
Train commuters have protested against the new rules, saying that journeys will be made longer, while regional authorities and trade associations warned against bottlenecks and higher costs for integrating businesses and labour markets.
Anna Johansson, Sweden's minister for infrastructure, said she was aware "of possible delays" and inconvenience for cross-border commuters, but said the measures were necessary.
"The aim is to reduce the number of people seeking asylum. In 2015, we received about 163,000 people and in the long term we cannot cope with these numbers in order to cope with providing accommodation and schooling," she said.
In 2014, Sweden registered 80,000 bids for asylum.