Five minutes later, however, Emmanuel Gyasi arrowed a fine finish into the net to equalise, before Janis Antiste swung the momentum in the hosts' favour by putting Spezia ahead to leave Juve facing the prospect of another shock defeat.
The visitors dug deep in the second half with Italy forward Federico Chiesa battling into the penalty area before firing Juve level in the 66th minute, and De Ligt pounced to secure the win for his side six minutes later.
The victory moved Juve from 18th to 12th in the standings as Allegri earned his first league win since taking over as coach for the second time in the close season. Spezia stayed 16th.
"They scored at the beginning of the second half, but our character to win was important," De Ligt told DAZN. "The only thing that mattered was the three points.
"At Juventus we have to win all the games, now we have to start this season again, now we have that win."
All was not well in the Juve camp coming into the match, with Allegri’s team having not won any of their opening four league games of the season for the first time since 1961-62.
But Kean's fierce strike into the bottom corner, on his first Serie A start of the season, seemed to have set Juve on their way to an untroubled victory, with the hosts not looking like scoring in the opening period.
But Juve, without a Serie A clean sheet since early March, were again breached as Gyasi levelled, before Antiste capitalised on slack defending to send the home fans into raptures, dreaming of a famous victory over Serie A's most successful side.
However, Chiesa had other ideas, as he equalised out of nothing, before De Ligt drilled into the net from a corner to bring welcome relief for Allegri.