Security personnel shot and killed the assailant, putting an end to his killing spree.
The churchgoers were celebrating Maslenitsa, a traditional pre-Lent festival for Russian Orthodox Christians.
Four women were killed instantly, and a fifth passed away in hospital, the BBC reported.
The Islamic State has claimed responsibility for the deadly shooting, which occurred in Kizlyar in the Muslim-majority province of Dagestan in southern Russia. The small republic in the Caucasus mountains borders Chechnya, where Moscow has led two wars against separatists and radical Islamists.
The attacker was identified as 22-year-old Khalil Khalilov. He reportedly shouted “Allahu Akbar” before mowing down his victims, a priest told local media as quoted by the New York Times.
ISIS has carried out several attacks already on Russian security personnel in the region. They identified the attacker as Khalil al-Degestani.