An investigation officer said that the accused took a long way to take Zainab to the place of crime, instead of a short route on which his own house was situated.
Police said that Ali was familiar with the minor's family and would frequently visit her house.
Residents of the area have said the murder was the 12th such incident in a year, setting off fears of a serial rapist killer on the loose.
Zainab's father, Muhammad Amin Ansari, thanked all those who helped make the arrest in connection with his daughter's death, adding that he was in Saudi Arabia on pilgrimage when he found out Zainab had vanished.
The official said that the suspect has confessed. The post-mortem report revealed that she was raped before being murdered.
Punjab government spokesperson Malik Ahmed Khan had earlier confirmed that the suspect Imran had been arrested from near Pakpattan.
Police found Zainab Ansari's body in a garbage dumpster in Kasur district near the eastern city of Lahore last week, four days after she was reported missing.
The seven-year-old was kidnapped from near her aunt's house in Kasur on January 4.
He added that Ali was arrested on Wednesday but police waited to match DNA evidence before making an announcement.
The accused's DNA also matches the samples taken from seven other minor girls who were abused and murdered earlier in the area, it said.
But police detained him again and conducted the DNA test, which confirmed him as the perpetrator.
"Whenever anybody saw her picture on social media or on electronic media everybody started weeping", said Waqas Abid, a lawyer in Kasur who heads an activist group called the Good Thinkers Organization.
Zainab's sister Laiba spoke to Geo News, and said if Imran was the real murderer then he should be publicly hanged.
The neighbours had handed over Imran after Zainab's body was recovered, however, he was released from custody when his condition deteriorated. A Pakistan police official speaking anonymously said that the accused had confessed to multiple murders and was also suspected of raping and killing at least 7 other girls.
Cyber Monday 2017 – The top sellers in electronics this year
Apple’s 9.7-inch Wi-Fi enabled iPad Pro was also still a great seller thanks to massive price discounts from retailers. Microsoft dropped their game changing console update, the Microsoft Xbox One X with a 1TB hard drive and 4K compatibility.