Both militants were killed in the attack in the town of Kathua, 70 kilometers (43 miles) south of Jammu, Kashmir's main city.
"The operation is over," state police chief K. Rajendra told CNN. "We lost two paramilitary central reserve police force troopers and a cop in the gunfight. One civilian was also killed."
Nine security personnel and a civilian were injured in the seven-hour-long standoff, Rajendra said.
The police chief said the militants in the dawn attack hurled several grenades and opened indiscriminate fire at the police station, then forced their way into the building.
Indian army and paramilitary reinforcements were rushed to the area, and the holed-up militants engaged in a sustained gunfight, during which both were killed.
Earlier, Indian security forces evacuated police from inside the police station before storming it.
Traffic on the main highway that runs through the town remained suspended during the gunfight, stranding hundreds of vehicles.
Friday's attack was just the latest of several violent incidents in the area bordering Pakistan, and comes days after a new Peoples Democratic Party-BJP coalition government took over administration of Kashmir.
On assuming office, the new chief minister, Mufti Mohammad Sayeed, had credited the militants and separatists for smooth conduct in the 2014 election to the state assembly.
Kashmir has been in the throes of separatist violence since 1989. More than 42,000 have died, according to official records. Various rights groups and nongovernmental organizations say the actual number is closer to twice that.