Finland’s Social Democrats were projected to have won a legislative election for the first time since 1999, edging out a nationalist movement in an election that echoed the polarization and populism seen elsewhere in Europe.

With 99% of Sunday’s vote counted, the country’s Justice Ministry said the Social Democratic Party was likely to have taken 17.7%. That relatively modest showing put the party in position to win after a campaign where debates over climate change, immigration and austerity prompted voters to embrace upstart...