Germany can win even without Mario Gomez scoring.
The striker failed to score for the first time at this year's European Championship but Germany grabbed the goal it needed to reach the quarterfinals from a player making his tournament debut out of position in defense.
Lars Bender, who only made the team because right back Jerome Boateng was suspended, scored in the 80th minute in his first start for his country to secure a 2-1 win over Denmark and a meeting with Greece in Gdansk.
"It's absolutely a day of joy," Bender said. "I'll be thinking back to this day a long, long time. We have a positive spirit in the team.
"We were seeking the second goal. It was fortunate that one of their players slipped. You don't think very long in that situation, you just fire away."
Bender usually plays in midfield, but executed his defensive duties well in his emergency role before scoring the winner — the Bayer Leverkusen player's first goal for Germany in his ninth game.
"They had some chances at 1-1, but thank God, Lars scored," midfielder Bastian Schweinsteiger said.
In a nervy second half, Germany remained vulnerable to a late Denmark goal that would have sent the three-time champions to a shock exit, until Bender scored the relieving winner.
He was rewarded for his driving run into the box from deep when he met a cross from Mesut Oezil that just evaded substitute Miroslav Klose.
"He has no fear, no overdue respect," Germany coach Joachim Loew said. "When I told him that he was going to play, he simply said, 'I'm looking forward to it.' That's the kind of person he is.
"Lars fulfills all criteria to be a good full back, he has a lot of pace. The game hung in the balance and he notched the winner with great poise."
Loew showed good instinct for picking the right lineup by selecting Bender to replace Boateng. The coach had considered picking Bender for the opening match against Portugal, when he would have been marking Cristiano Ronaldo, but decided against it in the end.
Bender has never played in the position for his club. His twin brother Sven, a midfielder for the Bundesliga champion Borussia Dortmund, failed to make the final cut when Loew announced his Euro 2012 squad.
Bender's late goal lifted a huge burden off the shoulders of his teammates.
"We could have been eliminated," Loew said, "and that was on our minds."