Zainab Ansari's body was found in a rubbish dump in the city of Kasur, south of Lahore, on 9 January.
Her murder triggered outrage across the country, including riots against alleged police incompetence in which two protesters died .
The victim's father was in court to hear the verdict, amid heavy security.
Zainab's killer has also been linked by police and the chief minister of Punjab province to the murders and assaults of other girls in the area.
Ali's alleged crimes stretch back at least a year and angry residents say authorities should have been quicker to identify him as the perpetrator.
Ali will be tried over the rest of the cases later, government prosecutor Ehtisham Qadir Shah told Reuters news agency.
Dozens of witnesses testified against Ali in the trial, where forensic evidence including DNA and polygraph tests was also presented.
His lawyer had withdrawn from the case after Ali confessed, reports say.
Ali was handed death sentences for kidnapping, rape, murder and an act of terrorism, a life sentence for sodomy and a large fine. He now has a 15-day window in which he may appeal against the verdict.
The news of his sentencing sparked strong reactions on social media, including by Hamza Ali Abbasi, a Pakistani actor, model and director.
Some echoed calls by Zainab's parents for Ali to be hung in public at the spot in which he kidnapped her, but commentator Ali Moeen Nawazish disagreed.
Other Twitter users suggested there could be a wider network of criminals behind the spate of child killings, and have called for investigations to continue before Ali is executed.
Police have been under huge pressure to find who killed Zainab and the other children.
Zainab's family say the police did not take action during the five days from when she was reported missing and her body was found. Relatives recovered CCTV footage of her last movements.
The video, which showed a girl being led away by a man, was circulated widely on social media.
Ali, who lived near Zainab, was arrested by police on 23 January.