Spain led for much of the showpiece World Cup qualifier thanks to an early goal from Real Madrid defender Sergio Ramos.
The defending world champions spurned a glorious opportunity to double their advantage when Cesc Fabregas saw his penalty saved by Hugo Lloris.
Didier Deschamps side pressed late on and punished Spain for their wasteful finishing when Arsenal forward Giroud calmly headed home a cross from Franck Ribery deep into injury time.
"We believed until the end, it is something extraordinary coming back from a game like this because we had opportunities throughout the game," Giroud told TF1.
"This is really deserved because the whole group remained supportive. Today, it is me who made the difference and it's nice because I only played five minutes. It was really good and we all believed until the end."
Giroud's goal stopped Spain winning a qualifying match for the first time since 2007.