Alessandro Cortese, an Italian foreign ministry spokesman, was reported by AFP as saying that Mastrogiacomo had spoken to Ettore Francesco Sequi, the Italian ambassador in Kabul, by telephone to confirm his release.
The Taliban had said on Sunday that they released Mastrogiacomo into the hands of local elders. They said Mastrogiacomo had been held for allegedly spying, along with his Afghan translator.
Afghanistan's Pajhwok news agency said Mastrogiacomo had been handed to "Italian officials" in southern Helmand province.
Mullah Dadullah, the Taliban's military commander, was reported by Reuters as saying the Italian had been freed after the Afghan authorities released five senior Taliban officials, including Dadullah's brother.
Earlier, a Taliban spokesman was reported as saying the Karachi-born reporter, who works for Italy's La Repubblica newspaper, was released after Afghan authorities freed three Taliban officials.
Qari Mohammad Yousuf, a Taliban spokesman, said: "We handed over the two to a third party after we got two of the three people we wanted to be freed."
In Italy, Romano Prodi, the Italian prime minister, said Mastrogiacomo had been taken to hospital in Afghanistan run by Emergency.
"He is in the Emergency hospital and is in good health. I hope that in a few days we will be able to embrace him," Prodi told reporters.
Emergency is an Italian medical aid group which runs a hospital in Helmand province and was involved in the negotiations for the release of another Italian reporter last year.
Mastrogiacomo, along with his driver and translator, was seized in the southern province of Helmand last week. The Taliban said he had confessed to spying for British troops.
Media reports said Mastrogiacomo's driver was killed on Thursday.