The match looked like it would be a cakewalk for the 2016 champion when she cruised through the first set and took a 5-2 lead in the second.
But the hot and humid conditions appeared to wear down the 30-year-old German, who dropped five consecutive games behind shaky serving and a raft of errors as Larsson raised her game.
A 10-minute heat break ahead of the third set rejuvenated Kerber, who seized the momentum as she broke to take a 4-3 lead before smashing a forehand winner to end the 2-1/2-hour battle.
"I think we both really played on a really high level from the first point," Kerber said. "It was just one or two points that decided the match."
The German said she struggled with fatigue but added that it was nothing new at the always challenging fourth and final Grand Slam of the year.
"It's always a battle here, especially in these conditions," she said. "You just have to take it point by point."
Next up is a third-round meeting with 29th-seeded Slovak Dominika Cibulkova, with Kerber having won seven of their 12 career meetings, most recently a straight sets victory on the grass at the Eastbourne International this year.