The incident took place when the accused forced the 35-year-old victim to accompany him to the nearby garden where he raped her at gun-point, police said.
The victim opposed his attempts and shouted, attracting the attention of passersby, who rushed to the spot and nabbed the man.
The accused, identified as Rahees, has been arrested and a pistol and some cartridges recovered from his possession, police said.
An FIR was lodged by the victim against the accused, police said, adding, the woman has been sent for medical examination.