Both sides came into the clash needing points in their quests for European qualification, but all the attention was on the most decorated player in Inter's history.
Fourty-year-old Zanetti, who is Argentina's most-capped player with 145 outings, has lifted 16 trophies with the club since joining from Banfield in 1995, but his 857th appearance for Inter had to wait until the second half.
Initially the hosts appeared to be in trouble as Giuseppe Biava put Lazio ahead in the second minute, but Inter battled back and ultimately went into the break 3-1 up thanks to two goals from Palacio and Mauro Icardi's strike.
Zanetti was introduced to much fanfare just after the break and although Lazio crafted numerous opportunities in the second period, Hernanes sealed the result against his former club with a stunning effort from range.
Victory means Inter are all but guaranteed a spot in the UEFA Europa League, with defeat for Lazio ending their hopes of a top-six finish.
With an expectant home crowd displaying banners of thanks for Zanetti, coach Walter Mazzarri was greeted with a frosty reception from the home faithful as word of the Argentinian's absence from the XI spread.
And things got even worse for him in just the second minute as Lorik Cana headed Bruno Pereirinha's free-kick back across goal for Biava to prod in.
Lazio barely held the lead for five minutes, however, as Palacio raced on to Mateo Kovacic's defence-splitting throughball and deftly poked a clever finish past Etrit Berisha.
Proceedings quietened down after a frantic start, but Kovacic produced another moment of magic in the 34th minute, delivering a delightful outside-of-the-foot pass to Icardi, who coolly slotted home from inside the area.
Inter doubled their advantage just three minutes later.
Yuto Nagatomo's left-wing cross evaded the Lazio defence and Palacio duly stroked the ball beyond Berisha's reach.
The second half endured a muted start as the inevitable arrival of Zanetti was anticipated and Mazzarri finally unleashed his captain in the 52nd minute, drawing a thunderous ovation from the crowd.
Lazio were in no mood to stand around and appreciate the retiring midfielder, however.
Samir Handanovic denied Biava a second with an acrobatic save to his right, before Balde Keita inexcusably sliced a half-volley well over the crossbar from 14 yards.
Lazio's pressure continued into the final stages, but any threat of an unlikely comeback was thwarted with 11 minutes to go as Hernanes rifled in an unstoppable left-footed effort from 20 yards.
Zanetti was the game's final focus as he consoled a supporter who had run onto the pitch and approached him - an act met with applause from all sides of San Siro as the emotional fan was escorted from the field.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.