The FSB, the main successor to the Soviet-era KGB, named the British diplomat, a second secretary at the Moscow embassy, and said he was working undercover for Britain's spy service.
Russian media on Thursday carried pictures of the diplomat.
Russia said he has been given two weeks to leave Russia.
Britain's Foreign Office did not immediately respond to a request for comment.
Russia's foreign ministry summoned Britain's charge d'affaires in Russia, Danae Dholakia, to issue a formal protest about the situation.
"It was again stressed that Moscow would not tolerate the activities of undeclared British intelligence officers in Russia," the foreign ministry said in a statement.
"A warning was also issued that if London escalates the situation, the Russian side will give a decisive 'mirror' response."
Protesters at the foreign ministry chanted anti-British slogans in front of the British diplomatic car carrying the charge d'affaires.
Amid the war in Ukraine, Russia and the West have repeatedly accused each other of unfurling espionage campaigns of an intensity not seen since the depths of the Cold War.
Russia says that the CIA, Britain's MI6 and France's DGSE have stepped up attempts to steal secrets, recruit Russians and sow discord inside Russia.
Western European spy chiefs say the FSB, Russia's SVR foreign intelligence service and the GRU military intelligence service have mounted major cyberattacks and sabotage campaigns across the Western world, something Moscow denies.