Denmark saw off Scandinavian rivals Sweden in a hard-fought 27-25 battle in Paris while hosts France and Brazil advanced without playing thanks to Russia's 24-20 win over Poland in the western city of Nantes.
Other teams assured their qualification on the pitch with Spain crushing African minnows Angola 42-22, Slovenia easing past Macedonia 29-22 and Croatia dominating Belarus 31-25.
The Danes lead Group D after three consecutive wins and will be assured of top spot if they beat lowly Bahrain on Wednesday, to avoid meeting France should they beat Russia on Tuesday.
France have six points and cannot be caught by Group A rivals Poland and Japan, who have lost all three of their group matches.
For Sweden it is the first loss at France 2017, but they are still in a good position to qualify on four points.
The four top teams out of six in each group advance to the next round.
The Danes owed their victory largely to captain and goalkeeper Niklas Landin -- making 23 saves and voted player of the match -- with Henrik Toft Hansen the top scorer with eight goals.
The Olympic champions took a good quarter of an hour to settle after a half a dozen shots on Swedish goalkeeper Mikael Appelgren.
Sweden's anti-Hansen plan worked well in the first period, but the Danes have depth and could also count on Henrik Mollgaard and Kasper Sondergaard to find the net.
Danish indiscipline in the second half -- four exclusions in 20 minutes -- caused some concern among their many fans.
But with the scores 20-21 ten minutes from the end, the Danes dug deep in a fast and furious game down until the final seconds.
In Group B top spot will be played between Spain and Slovenia on Thursday.
Croatia beat Belarus in Group C and will be up against Germany for top spot on Friday.
Egypt rebooted their campaign by beating Bahrain 31-29 and Hungary dominated Chile 34-29.