Anis Amri, 24, was accused of killing 12 people and wounding dozens more in Monday's assault on a Christmas market, which has been claimed by the Isis jihadist group.
Italy's interior minister Marco Minniti told a press conference in Rome that Amri had been fatally shot after pulling out a pistol and firing at police who had stopped him for a routine identity check around 3:00 am (0200 GMT) near Milan's Sesto San Giovanni train station.
Identity checks had established "without a shadow of doubt" that the dead man was Amri, the minister said.
He hailed the two policemen as heroes. Trainee officer Luca Scata, 29, fired the fatal shot. His partner Cristian Movio, 36, was hit in the shoulder and was in hospital awaiting surgery, but not in any danger.
"Italy can be really proud of these two officers," Prime Minister Paolo Gentiloni said.
"We remain on maximum alert, we will not underestimate the threat but what happened overnight shows citizens that the state is there for them."
Amri's death comes as German police arrested two brothers on suspicion of planning to attack a shopping mall, while authorities in both Australia and Indonesia reported that Christmas terror plots had been foiled.
Amri had been missing since escaping after Monday's attack in central Berlin.
He had links to Italy, having arrived on a migrant boat in 2011 during the Arab spring.
Relief in Germany
Shortly after his arrival he was sent to prison for starting a fire in a refugee centre. He was released in 2015 and made his way to Germany, taking advantage of Europe's open borders, as he did on his return to Italy.
Milan police chief Antonio De Iesu said Amri had arrived in Italy after travelling through France.
German police said the Tunisian had steered the 40-tonne truck in the attack after finding his fingerprints inside the cab, next to the body of its registered Polish driver, who was killed with a gunshot to the head.
A 100,000-euro ($104,000) reward had been offered for information leading to Amri's arrest.
In Tunisia, a brother of the fugitive had appealed to him to surrender and said: "If my brother is behind the attack, I say to him 'You dishonour us'."
German officials voiced relief that Amri had been found. Chancellor Angela Merkel has said she is "proud of how calmly most people reacted" to the country's deadliest attack in years.
But her assuring message failed to dampen furious criticism of security lapses and bungling in the investigation.
'A lot went wrong'
Amri was a rejected asylum seeker and had long been known to German counter-terrorism agencies.
He was also on the radar of Italy's anti-terrorism police unit, having been identified as having possibly being radicalized in prison, Corriere della Sera said.
German news weekly Der Spiegel reported that in wiretaps, Amri could be heard offering to carry out a suicide operation, but that his words were too vague for an arrest warrant.
Amri had been monitored since March, suspected of planning break-ins to raise cash for automatic weapons to carry out an attack - but the surveillance was stopped in September because Amri was seen primarily as a small-time drug dealer.
Conservative lawmaker Stephan Mayer, a critic of Merkel's liberal stance on refugees, said the case "held up a magnifying glass" to the failings of her migration policy that brought almost 900,000 asylum seekers to Europe's top economy last year.
"It's clear that a lot went wrong... it was a systemic failure," said Peter Neumann, professor of security studies at King's College London.
Neumann argued that German security services lacked the manpower to maintain around-the-clock surveillance of the 550 known radical Islamists in Germany.
"Once the dust settles, it will be important to have a fundamental rethink," he added.
As the security debate raged, Germans were trying to carry on as normal but Christmas lights and singing were kept low-key out of respect for the victims.
Berliners have flocked back to the Breitscheid square market, which reopened on Thursday, and the government has urged citizens not to give in to fear.
On Friday, a memorial concert was planned at the iconic Brandenburg gate under the theme of "Together Berlin".
Among the dead were six Germans, 60-year-old Israeli Dalia Elyakim, and a young Italian woman called Fabrizia Di Lorenzo. Forty-eight others were injured.
Germany had until now been spared the jihadist carnage that has struck neighbouring France and Belgium.
But it has suffered a spate of smaller attacks, including two in July that left 20 people injured, both committed by asylum seekers and claimed by Isis.
By Marco Bertorello, with Angus MacKinnon in Rome and Frank Zeller in Berlin