She was rescued by local people at Chawkbazar when she was coming out of a building with blood and injury marks on her body. They took her to Dhaka Medical College Hospital.
The rapist was held by the DMCH outpost police as he was following the girl to the hospital.
The rape survivor, a class VII student, lives in Pallabi area of Mirpur with her family. She had been talking to one Mehedi, 25, over the phone and Facebook for the past six months, her uncle said.
On Saturday morning, the girl left for school but went to Chawkbazar to meet Mehedi as he had enticed her to meet him.
They met at an empty house at Chawkbazar where she was raped, SI Bachchu Mia of DMCH outpost told the Dhaka Tribune.
Residents of another flat in the same building found the girl and rescued her.
Mehedi has been kept at Chawkbazar police station.