The men were killed around 3.30am local time, according to Priya, a police sub-inspector in Hyderabad who goes by one name.
Another police official said the suspects tried to grab an officer’s firearm and escape during a visit to the crime scene.
The suspects were taken to reconstruct the crime scenes, both where the rape is suspected of taking place and the spot where the woman’s body was burned about 600 yards away, according to Shreedharan, an official in the police commissioner’s office who uses one name.
The burned body of a 27-year-old woman was found last week by a passer-by in an underpass in Hyderabad after she went missing the previous night.
The high-profile case has sparked protests across India.
About 300 people gathered at the crime scene in Shadnagar, a town in the state of Telangana about an hour south-west of Hyderabad, to praise police for fatally shooting the suspects.
Some hugged officers and lifted them into the air chanting “long live police”, while others showered them with flowers.
But in New Delhi, some observers condemned the police killing.
“This type of justice is counterfeit,” said Kavita Krishnan, secretary of the All India Progressive Women’s Association.
“The killings are a ploy to shut down our demand of accountability from governments, judiciary and police, and dignity and justice for women. We demand a thorough investigation into this,” she said.
Maneka Gandhi, a lawmaker from India’s ruling Bharatiya Janata Party and a former Cabinet minister, accused police of taking the law into their own hands.
“They would’ve been hanged by court anyway. If you’re going to kill the accused before any due process of law has been followed, then what’s the point of having courts, law and police?” she said.