His body has not been recovered.
Mastrogiacomo, a Pakistani-born La Repubblica newspaper reporter, is due in Kabul on Tuesday, according to Ettore Francesco Sequi, the Italian ambassador.
"[He is in] very good health," Sequi told reporters late on Monday night. "He's in very good physical condition."
The Taliban say he was freed after the Afghan government handed over four of five insurgent leaders, including the brother of Mullah Dadullah, a military commander.
Another Italian journalist, Gabriele Torsello, was kidnapped in Helmand in October and held for three weeks before being released unharmed.
Helmand, the country's opium centre, and neighbouring Kandahar province, are considered the most dangerous places in Afghanistan.
Mastrogiacom said after his release: "My head is still spinning but I am happy. I managed to get out of the situation and I thank everybody who helped me.
"This is the most wonderful moment of my life."
The journalist said he had been "bound hand and foot" by his captors and moved to 15 different locations "as small as sheep pens, in the middle of the desert".
He did not explain why he was travelling in an area regarded as unsafe for foreigners. Sequi refused to say if a ransom had been paid.
Nato launched a large offensive in Helmand this month to take on the Taliban and drug lords.