LONDON—U.S. and U.K. intelligence agencies said Russian cyberattackers are targeting critical internet infrastructure to spy on Western companies and governments, the latest salvo in a diplomatic crisis that has brought relations between Moscow and the West to their lowest level in decades.

In a rare joint alert, the U.S. Department of Homeland Security, the Federal Bureau of Investigation and the U.K.’s National Cyber Security Centre said Russian state-sponsored hackers had penetrated devices and software programs world-wide,...