Russian television showed police with automatic weapons and body armour dragging the charred corpses of gunmen away from a collapsed house in the Tukui-Mekteb village in the Stavropol region of southern Russia.
Officials said fighters linked to the long-running Islamist insurgency against Moscow's rule in the nearby North Caucasus had been holed up in the village.
About 300 residents were evacuated and there were no civilian casualties, officials said.
An Interior Ministry spokesman, the Interfax news agency reported, said: "Most of the militants have been wiped out but there are still several who have been able to hide but they are trapped and will be destroyed."
Police were using helicopters and sniffer dogs to search for any remaining insurgents, Itar-Tass news agency reported.
Fighting began on Thursday
Police and special forces were rushed to the village from across the region after the fighting began on Thursday.
The incident is unusual because it took place outside the mainly Muslim North Caucasus region where police and troops regularly clash with insurgent fighters.
Previous forays by insurgents outside the North Caucasus and deeper into Russia have led to large numbers of civilian deaths.
A local Interior Ministry official said the insurgents were planning to take a school in the village hostage hinting at a 2004 attack on a Beslan school in southern Russia that left more than 300 hostages dead.
"We received information that they were planning a terrorist act, including the taking of a children's establishment in the region," RIA news agency quoted Viktor Barnash, head of the local police organised crime division, as saying.
Since Beslan, Russian security forces have said on several occasions that rebels they had intercepted were planning a similar attack.
However, they have never produced conclusive proof.