But his pro-Western party is set to win 41% of the votes, short of the majority he wanted to ensure a push to join Nato and the EU.
Mr Djukanovic had presented the vote as a choice between the West or becoming a "Russian colony".
Earlier, authorities said 20 Serbian paramilitaries had been arrested.
Prosecutors said the group may have been planning to kidnap Mr Djukanovic, who has been in charge for a quarter of a century.
The development, hours before voting took place, was described by opposition Democratic Front leader Andrija Mandic as "gross propaganda" and Serbia's prime minister, Aleksandar Vucic, said the timing was strange.
Serbia's former special forces commander, Bratislav Dikic, who was removed from the post in 2013 because of alleged criminal activities, was reported to be among those arrested.
The men had been charged with terror offences and one Serb was still on the run, Montenegro's police chief said.
Montenegro: Nato's newest and last member?
Montenegro country profile
Mr Djukanovic will now try to form a majority with smaller parties, and told supporters as the results came through that "tonight we can say that Montenegro will continue its path towards a secure place in Europe".
Montenegro would formally join Nato in months and step up talks on joining the EU, he said.
The Democratic Front Alliance, made up of largely pro-Serbian and pro-Russian groups, is forecast to win just over 20% of the votes. It also hopes to form a coalition among other opposition parties. Another, more moderate, opposition grouping stands at about 11%.
Many Montenegrins are unhappy that Mr Djukanovic is taking the country into Nato.
They remain angry that Nato bombed Serbia and Montenegro in 1999 as part of a strategy to halt the killing and expulsion of ethnic Albanians in Serbia's then southern province of Kosovo.
The opposition accuses Mr Djukanovic of corruption and cronyism, which he denies. He accuses them of receiving funding from Moscow, which they deny.
Montenegro, which has a population of some 630,000, has in recent years seen an influx of Russian money, homebuyers and tourists since splitting from Serbia in 2006.
Montenegro Prime Minister Milo Djukanovic has declared victory in elections and pledged to push for closer ties to Nato and the EU.