Earnshaw had the ball into the back of the net for a second time, but an offside flag cut short any more wild celebrations.
The visitors finally rediscovered their composure but still failed to make any inroads into the Welsh defence as the likes of Robbie Savage, Mark Pembridge and Robert Page kept up their tenacious tackling.
Carsten Jancker was brought on with some 20 minutes to go and his presence immediately caused some alarm.
The striker delivered a fierce low cross and Gary Speed had to be at full stretch to block Klose's shot from inside the six-yard box.
Germany came even closer on 75 minutes when substitute Marco Bode hit the post with a far post header which gave Crossley no chance.
The keeper then conceded an unnecessary corner after his clearance rebounded straight off Page's head.
But the defender headed clear and Giggs then set off on a run the full length of the pitch. His cross eventually reached Davies on the far-post but the young Spurs winger let the chance slip away.
Almost immediately, Wales rode their luck again as Janker this time crashed a fierce volley against the post.
In injury time, Chris Coleman made his long-awaited comeback as a substitute
for man-of-the match Earnshaw.
But there was not enough time for the Fulham defender to have his first touch as the referee blew the final whistle to end a memorable night in the Welsh capital.
Wales: M Crossley (Middlesbrough); M Delaney (Aston Villa), G Speed (Newcastle, capt), A Melville (Fulham), R Page (Sheff Utd), M Pembridge (Everton), R Savage (Leicester), R Earnshaw (Cardiff), S Davies (Tottenham), R Giggs (Manchester Utd), J Hartson (Celtic).
Subs: D Coyne,
D Barnard, G Taylor, P Evans, C Coleman, R Weston, S Jenkins.
Germany: O Kahn (Bayern Munich); J Heinrich (Borussia Dortmund), C Metzdeler (Borussia Dortmund), T Linke (Bayern Munich), C Ziege (Tottenham), T Frings (Werder Bremen), S Deisler (Hertha Berlin), D Hamman (Liverpool), J Jeremies (Bayern Munich), M Bode (Werder Bremen), O Bierhoff (AS Monaco).
Subs: J Lehmann, C Jancker, G Asamoah, S Kehl, Ernst, M Bode, O Bierofka, Freier, Rahn,
Referee: Roy Olsen (Norway)