"I'm delighted with our boys, I'm just sorry we didn't score," said Irish interim coach Noel King, whose side pushed hard for a consolation before Ozil scored.
Sweden clinched second place with a game to spare in Group C after Zlatan Ibrahimovic scored late for a 2-1 win over Austria in Stockholm. Austria finished the game with 10 men after Marco Arnautovic was sent off in the closing minutes.
Earlier, the Faeroe Islands drew 1-1 at home against Kazakhstan in a game that had no bearing on qualifying.
Despite missing a host of players through injury, Germany dominated against Ireland, particularly in the first half with more than 75 percent possession and 13 shots on goal compared to two from the visitors.
Lahm put in a captain's performance, and it was his interception from an ambitious Irish pass that set up Khedira to score.
It seemed just a matter of time before the second goal arrived but the visitors went closest just before the break when Ciaran Clark struck the crossbar with a header after a free kick and Anthony Stokes missed the rebound.
Stokes had two good chances after the interval, and James McCarthy shot over as the Irish improved drastically for the second half.
However, Kroos unlocked the visitors' resolute defense with a delightful ball for Schuerrle to turn and pick his spot.
Jerome Boateng struck the crossbar late on, but it was the Irish who made a late surge, before Kroos took advantage on a counterattack to send Ozil through to chip the goalkeeper.
"Altogether it was a very good qualification. We've won eight from nine games and we should have won the ninth," said Germany coach Joachim Loew, referring to the 4-4 draw with Sweden in October 2012, when the Swedes fought back from four goals down.
Sweden hosts Germany on Tuesday in a now-meaningless final game.
"We have a little score to settle with Sweden and so we'll approach the game in all seriousness," Loew said.
Martin Harnik gave Austria a 29th-minute lead in Stockholm, only for Ibrahimovic to set up Martin Olsson to equalize with a diving header in the 56th.
Ibrahimovic then sealed the win in the 86th when substitute Kim Kallstrom found him with a long ball into the area. The Sweden captain controlled the ball with one touch and then slotted a low shot into the far corner with his second.
"It's magical," Ibrahimovic said. "It was a fantastic feeling. Now we're one step closer to the World Cup."
However, Ibrahimovic will be suspended against Germany after a late booking in the final minutes.