In Thursday's semi-finals, Denmark will face newcomers Austria who beat Spain 5-3 on penalties following a goalless draw in Tilburg.
Germany, who have won the Euro six times in a row and eight times overall, dominated the eventful game postponed from Saturday because of heavy rain, but Denmark's counter-attacking was eventually too much for them.
Germany were out of the blocks fast with Isabel Kerschowski drawing first blood on three minutes with massive help from Danish keeper Stina Petersen who palmed her shot from just outside the box into the goal.
But Nadim put Denmark level three minutes after the break with a bullet header from a cross by Stine Larsen and Nielsen then headed home a cross from substitute Frederikke Thoegersen with seven minutes left.
"I'm so happy that we beat Germany. It's amazing," said Nielsen. "Everybody dreams about scoring, but doing it is another thing. Why not today? It's a good day."
Denmark coach Nils Nielsen said the win was deserved as winger Katrine Veje hit the woodwork after a Nadim pass flicked on by Harder with half an hour to go, while Petersen regained her self-confidence with several brilliant saves.
"It was fairly equal in term of the chances. Germany didn't put us under big pressure."
German coach Steffi Jones bemoaned a lack of will to win on the German side.
"There's a lot of disappointment. We weren't aggressive enough," she said.