Fiorentina took an eighth-minute lead through Alessio Cerci but Hernanes equalised before the half-hour mark and although Fiorentina looked the most likely to snatch all three points, it was Germany international Klose who headed in the winner with seven minutes remaining.
Lazio went into the game on the back of a 2-1 midweek defeat at Sporting Lisbon in the Europa League while Fiorentina looked for their third straight victory at home.
The hosts started strongly and took a deserved lead when Stevan Jovetic fed Cerci inside the area and he drilled the ball past Lazio goalkeeper Federico Marchetti.
Lazio hit back in the 28th minute from their first real chance of the game.
Klose served Hernanes in the middle of the area and he struck a left-footed shot past Fiorentina goalkeeper Artur Boruc.
Hernanes should have put the visitors in front five minutes later, but his powerful header from Klose's cross was saved by Boruc.
Lazio had the first opportunity of the second half as Andre Dias got his head to Hernanes' corner kick but his close-range effort was kept out by Boruc.
Fiorentina pushed forward more aggressively as the half went on and almost broke the deadlock on the hour mark when Marchetti came off his line to clear Cerci's cross with substitute Santiago Silva ready to pounce.
Shortly after, substitute Nenad Lulic's poor clearance inside his area almost cost Lazio dearly but the defender recovered to block Cerci's goal-bound shot.
Just when the hosts looked to have the upper hand, Lazio went in front.
Substitute Giuseppe Sculli headed a long cross from the left towards the area and Klose nodded it past Boruc.
Lazio held on for their second win of the campaign.