MOSCOW—A Moscow court upheld a decision to ban the professional social network LinkedIn Corp. in Russia on Thursday in a landmark ruling enforcing a personal data law.

LinkedIn is the first foreign company to publicly clash with Russia’s communications regulator, Roskomnadzor, over the law, which requires foreign and local companies to store personal data of Russian users within the country’s borders from September 2015.

A...