President Barack Obama on Thursday issued a dramatic response to Russia’s alleged use of cyberattacks to interfere with the 2016 presidential election, including imposing sanctions on Russian agencies and companies and expelling dozens of suspected intelligence operatives from the U.S., in one of the biggest diplomatic confrontations between Washington and Moscow since the end of the Cold War.

Russia threatened to retaliate, while U.S. lawmakers called for even stiffer measures and a deeper investigation into Moscow’s hacks,...