The 22-year-old came off the bench to finish a counterattack and complete the holders' comeback win, giving Real the advantage for the return game in Madrid next Tuesday.
Bayern took the lead at the Allianz Arena through Joshua Kimmich but Marcelo equalised just before the break and Asensio put Real ahead.
Despite Bayern dominating possession and creating twice as many chances as Real, Madrid claimed a sixth straight win over the Bavarians in the Champions League knockout stage.
With barely five minutes gone when Arjen Robben limped off to be replaced by Thiago Alcantara.
Bayern changed their system with right back Joshua Kimmich moving up to plug the space on the right wing, which sparked the opening goal.
When Bayern goalkeeper Sven Ulreich played the ball down the flank, James released Kimmich with a perfectly-timed pass in the 28th minute.
The Germany international raced clear and caught out Keylor Navas at his near post to stun Real.
Marcelo conjured the equaliser on 44 minutes.
When Dani Carvajal headed the ball across the edge of the box, it landed at Marcelo's feet and was in Bayern's net moments later after a fierce left-footed shot.
Real escaped again when Navas failed to hold a Lewandowski header just before the half-time whistle and the ball bobbled away to safety.
It shows how far Bale and Benzema have dropped out of Zidane's favour that Isco was replaced on the left wing by Asensio for the second half and the move paid off.
Rafinha lost the ball in midfield after a Bayern attack and Vazquez sprinted clear and put Asensio into space to curl past Ulreich on 57 minutes.
Moments later Bayern came within inches of an equaliser when Navas denied Mueller with a reflex save.
In the final five minutes Lewandowski beat Navas but his floated shot flew just wide of the post.