Security forces surrounded the mosque, in the village of Sheikh Gund, near Acchabal south of Srinagar, on Monday afternoon after receiving information that four militants were hiding there.
Three escaped and some local residents were sent inside the mosque to persuade the fourth to surrender.
The militant, identified as Bashir Ahmedwani, rebuffed the emissaries and continued his resistance before eventually giving himself up.
It is the sixth time this year that Kashmiri militants have taken refuge in a mosque and been surrounded by Indian troops.
Most of the other incidents ended in bloodshed and damage.
It is not clear if the mosque has been damaged in the latest standoff.
From the newsroom of the BBC World Service