France took an early lead on Tuesday when Randal Kolo Muani headed in a cross from Kylian Mbappe before Yamal's moment of brilliance in the 21st minute. Dani Olmo scored what was to prove the winner four minutes later.
Spain, who are chasing a record fourth European Championship title, will play England or the Netherlands in Sunday's final in Berlin.
They play each other in Dortmund on Wednesday.
There was surprise in Munich when Mbappe took to the field without the mask he has been wearing since getting his nose broken in France's opening group game.
Mbappe had been complaining the mask was impeding him, and ditching it appeared to have an immediate effect as he created the game's opening goal in the ninth minute with a tantalising cross to the back post that was headed in by Kolo Muani.
That was the first goal France had scored at Euro 2024 that wasn't a penalty or an own goal.
But there was no stopping Yamal's stunning equaliser as he became the youngest player ever to score at a men's European Championship — or World Cup — when he curled the ball past Mike Maignan and in off the left post from 25 yards.
And Spain turned the match around completely in the 25th minute when Olmo's goalbound-shot was turned into his own net by France defender Jules Kounde.
Dani Olmo slams home Spain's winning goal over France in Munich. (AP PHOTO)
France dominated possession in the second half but couldn't make it count.
Theo Hernandez should have done better when he blazed a good chance over the bar late on, and Mbappe did similar with four minutes remaining.
Spain could have been further ahead between those chances as another powerful strike from Yamal flew narrowly over the crossbar.