The match at the Stadio Olimpico looked headed for a goalless draw until the Czech Republic forward popped up to score the winner six minutes from time.
Kozak came off the bench and met Cristian Ledesma's cross with a powerful header to give Lazio all three points.
The result moved Lazio into second place, level on 37 points with Napoli after 20 games.
Samp went into the match inspired by last weekend's 2-1 triumph over Roma.
And Domenico Di Carlo's men seemed intent on repeating that display against Roma's city rivals with Nicola Pozzi's early strike from the heart of the area turned away by goalkeeper Fernando Muslera.
At the other end, Hernanes' right-footed shot from 30 yards was saved by Samp keeper Gianluca Curci.
Samp should have broken the deadlock before half-time but Fernando Tissone's effort from the edge of the area was kept out by Muslera.
The visitors continued their dominance in the second half and Giampaolo Pazzini missed a gilt-edged chance six minutes after the restart when he was left unmarked in the area yet still dragged his effort wide.
Shortly after the hour mark, Lazio's Mauro Zarate let fly with a 25-yard strike which whistled just past the right post.
And as the clock ticked down, Di Carlo's men made one final push to take the points.
With eight minutes remaining, substitute Federico Macheda's header from Vladimir Koman's cross went over the bar.
And instead Lazio had the final say with Kozak's effort from the heart of the area beating Curci.