Russia has accused Ukraine of trying to carry out armed incursions into Crimea - the territory annexed by Russia in 2014 after an unrecognised referendum.
The FSB intelligence agency said two attempted incursions had taken place over the weekend and a Russian soldier and an FSB employee had been killed.
President Vladimir Putin vowed "further security measures" in response to Ukraine's "stupid and criminal" acts.
Ukraine's president described the accusations as "preposterous".
"Russian accusations against Ukraine of terrorism in occupied Crimea sound as preposterous and cynical as the statements of the Russian leadership about the absence of Russian troops in the Donbass [region of rebel-held eastern Ukraine]," Petro Poroshenko said.
"These fantasies are only a pretext for making more military threats against Ukraine," he added.
Russian intelligence also said it had smashed a Ukraine military intelligence network in Crimea and detained a number of people. They included a Ukrainian national named as Yevhen Panov, who is described by Russian sources as a Ukrainian military intelligence officer.
The view from Moscow: Sarah Rainsford, BBC News
Russian state TV has been running pictures from the FSB, showing rucksacks packed with explosives. Ukrainian "saboteurs", sent by the defence ministry, were supposedly intending to use them in Crimea.
The claims of Ukrainian "terrorism" on the peninsula have sparked concern here that Moscow could respond with some kind of military action. The possibility has been discussed actively on social media, especially after President Putin's comment that he will not just "pass over" the death of two Russians.
Others suggest that the incident will be used - or was engineered, depending on your viewpoint - to scupper the complex peace process in Ukraine.
Straightaway, Mr Putin said more internationally-backed talks, due in the next few weeks, had been proved "pointless". So Russia has a reason to stall again on the Minsk peace process, maintain the unstable status quo in Ukraine and to blame Kiev for all of it.
The view from Kiev: Tom Burridge, BBC News
Russia says one of those detained is Yevhen Panov. Initial reports suggest he was a former military volunteer fighting for Ukraine in the east of the country. However he has apparently more recently been associated with a charitable organisation.
Ukraine has managed to contain the Russian-backed separatists in eastern Ukraine and, in purely military terms, it is hard to see what Ukraine has to gain by provoking its larger, much more powerful neighbour. For all the talk about rapprochements and peace in eastern Ukraine, there has been very little concrete progress. Fighting between Russian-backed separatists and the Ukrainians goes on every day.
Just two weeks before Ukraine celebrates 25 years of independence after the collapse of the Soviet Union in 1991, relations between Moscow and Kiev have taken another turn for the worse.
Kiev is preparing to celebrate the 25th anniversary of Ukrainian independence on 24 August, and officials have suggested Moscow may try to disrupt the celebrations.
Russia is preparing for a parliamentary election on 18 September.
The FSB said Ukrainian forces had intended to sabotage key infrastructure in Crimea.
"The aim of this subversive activity and terrorist acts was to destabilise the socio-political situation in the region ahead of preparations and the holding of elections," the spy agency said.
It said the attempted incursions had been accompanied by "heavy fire" from Ukrainian territory, resulting in the death of the Russian soldier. The FSB employee died while trying to detain infiltrators, it said.
Bombs, ammunition and mines had been found in the area where "terrorist attacks" had been foiled, it said.
Mr Putin said there was no point in further negotiations with Ukraine and called on the US and European countries to put pressure on Kiev to change its behaviour.
About 9,000 people are reported to have been killed in the conflict in eastern Ukraine that followed the Russian annexation of Crimea.
The annexation, which was itself largely bloodless, followed a vote to secede at a referendum on self-determination on 16 March 2014 - a ballot which was not recognised internationally.
The US and European Union imposed sanctions on Moscow in response to its seizure of the territory.