The Spanish had lost the last three finals and holders France moved in front with a Mathilde Bourdieu tap-in.
Patricia Guijarro fired home to level but a curled finish from Emelyne Laurent restored France's lead.
Damaris Egurrola made it 2-2 and France's Pauline Dechilly was sent off before Guijarro headed in the winner.
It was a repeat of last year's final but this time Spain emerged victors after losing in the final four times in the last five years.
Bourdieu slotted in from Laurent's cross in the fourth minute at Windsor Park to give France the perfect start.
Guijarro stretched to finish from a corner 14 minutes later but France were back in front when Laurent raced clear and curled beyond keeper Noelia Ramos with 19 minutes left.
Egurrola met Carmen Menayo's free-kick to head in on 85 minutes and Dechilly was dismissed for two yellow cards two minutes later.
The last-minute winner came from another Menayo free-kick, this time with Guijarro connecting at the back post to complete her double and clinch a thrilling victory.
Spain scored twice in the last five minutes to beat France 3-2 in a dramatic Women's European U19 Championship decider in Belfast.