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.

The company said Messenger Lite had the "core features" of the full app such as the ability to share text and photos.
The app will compete with Facebook-owned WhatsApp, which the company says is used by more than a billion people.
One analyst said offering a stripped-back service for developing markets would "drive adoption of services".
"Targeting users in emerging markets with 'lite' apps is not a new phenomenon," said Jack Kent, of the IHS Markit consultancy.
"Companies such as Google and Line also offer streamlined services for users in emerging markets.
"It makes sense to provide streamlined service to drive adoption of services rather than monetise users immediately."
Facebook was criticised in June after it removed access to messages from its mobile website, in an attempt to steer people to use the Messenger app.
Stan Chudnovsky, head of product at Facebook Messenger, said the company found people sent more messages when messenger was offered as a separate app.
He told BBC News people also found it easier to discover new features when they were not "buried" inside the bigger Facebook experience.
The company has slimmed the Messenger Lite app down to under 10MB, so it takes up less space on smartphones with limited storage.
That is up to 95% smaller than the full-size Messenger app, which case top 150MB on Android devices.
The Lite app will be released for Android devices in Kenya, Tunisia, Malaysia, Sri Lanka and Venezuela first.
Montenegro Prime Minister Milo Djukanovic has declared victory in elections and pledged to push for closer ties to Nato and the EU.
[NEXT_CONCEPT]
Facebook has announced a "slimmed down" version of its Messenger app for countries where older smartphones and slower net speeds are more common.