Alonso first scored with a thumping downward header in the 19th minute and then converted a penalty in injury time.
"We knew this was the most important match and we played very well," Alonso said. "Scoring the early goal really made things easy, so I must say we're happy."
"When you lose a game there's always something missing, I'm not sure if it's possession or technical ability," France coach Laurent Blanc said. "The lads gave everything and it's very hard to play against Spain. We blocked their left flank, which is their strong point."
The opening goal was the result of excellent one-touch football. Andres Iniesta prodded the ball through for Jordi Alba, who whipped a perfect cross from the left to Alonso.
"He knows how to sacrifice himself, help the team and where to play," Spain coach Vicente del Bosque said. "He is one of the attacking strengths of ours. He knows how to create and finish."
Spain wrapped things up after France right back Anthony Reveillere barged into substitute forward Pedro Rodriguez in injury time. Alonso coolly sent goalkeeper Hugo Lloris the wrong way from the spot, looking right but clipping the ball firmly to the left.
"They were there for the taking," Blanc said. "We knew we would get some chances, and the only thing I regret is that they scored off their first good chance."