France, needing to win in regulation time to steal fourth spot from the Slovaks, lost 5-4 in a see-saw game.
They got off to a bad start, conceding two goals in the opening seven minutes of the first period, but they fought hard to level the game 2-2.
In the remaining two periods, the Slovaks edged ahead 3-2 and 4-3, with the French coming back each time to level the scores.
With French forward Nicolas Besch in the sin bin for interference, Radivojevic netted the game-winning goal on the power play with 10 minutes to go in the third period and there was no way back for France.
The win gave Slovakia third place in Group H and a quarter-final meeting with Canada who beat Belarus 5-1 to top the group, with Ryan O'Reilly scoring twice.
The United States defeated Switzerland 5-2 to finish fourth and set up a quarter-final meeting with group runners-up Finland.
In Stockholm, Henrik Zetterberg scored one goal and made another as co-hosts Sweden beat Latvia 4-0 in Group S. They will now face the Czech Republic in the first knockout round.
Group winners Russia, who won all seven of their games at the preliminary stage, will face fourth-placed Norway, who beat Denmark 6-4 in their final group game.
The quarter-finals will take place in Stockholm and Helsinki on Thursday before Finland hosts the semi-finals, the bronze-medal match and the final.