© Getty Images
Muller had a chance to break the deadlock early in the first half as he tried to head the ball in from a cross, only to glance it wide from close range.
Scotland were almost back on level terms at the start of the second half when Steven Naismith carved out some space in the box, only to fire wide.
Germany responded, with Marco Reus turning the ball just wide before seeing a second effort saved by Marshall.
The world champions' missed chances allowed the visitors to get back into the game inside the final half hour, when Darren Fletcher flicked the ball on for Anya, who was given plenty of time to line up his shot, sliding it past Neuer.
Germany needed just four minutes to restore their lead, though, as Charlie Mulgrew and James McArthur both missed the chance to clear a corner, leaving the ball for Muller to smash in from close range.
The home side dominated possession for the final 15 minutes to ensure that Gordon Strachan's men did not get another chance to draw level again.
The visitors finished the match with 10 men as Mulgrew made a couple of rash challenges in stoppage time, resulting in two bookings in the space of a couple of minutes.