It means the world champions miss out on a bronze medal, with Giulia Gwinn’s second half penalty proving the difference in Paris.
Spain had been the dominant force, ending the match with 68% possession and double the amount of shots on the German goal.
However, they couldn’t make that pressure count, with Aitana Bonmati going closest in the opening 45 when she hit the woodwork.
After the break, Aleixandri and co.’s push continued but they fell behind when Gwinn was brought down by La Roja stopper Cata Coll inside the area.
She duly dispatched the chance, but Spain were presented with their own opportunity to force an equaliser deep into stoppage time when awarded a penalty of their own.
However, in dramatic circumstances, Alexia Putellas saw her spot kick saved by Ann-Katrin Berger, consigning the World Cup holders to a fourth-placed finish.
It means Germany have claimed a bronze medal on four occasions since 2000, while Aleixandri will hope to add to her personal trophy cabinet next season when she returns to the City Football Academy.