Juventus became the second team only to win Serie A without losing a game after Fabio Capello's AC Milan in 1991-92 and the first to achieve the feat in a 38-match season.
Del Piero curled the ball in from the edge of the penalty area in the 28th minute after Luca Marrone had fired the opener for Juve, who clinched the title one week ago.
Barzagli had come on to the pitch one minute earlier following an injury to Giorgio Chiellini and became the 20th Juventus player to score a league goal this season.
Club president Andrea Agnelli said last year that Del Piero's contract would not be renewed when it expires at the end of the season, although he is under pressure from supporters to backtrack.
Milan, where midfielder Gennaro Gattuso and defender Alessandro Nesta were also playing their last home games after announcing they would leave the club, fell behind to a Santiago Garcia goal in the 20th minute.
Defender Matthieu Flamini equalised in the 56th minute before Inzaghi, who came on midway through the second half, grabbed the winner in the 82nd minute, firing in a half-volley from Clarence Seedorf's pass.
Tough-tackling Gattuso left the San Siro pitch in tears as he ended 13 seasons at the club.
Juventus finished with 84 points, four ahead of Milan, with the two teams taking Italy's places in the group stage of the Champions League next season.
- Related links