The shadow foreign secretary received just under 18,000 votes. SNP candidate Mhairi Black, who is just 20 years old, received 23,500.
Earlier in the evening an exit poll had suggested the SNP was on course to take 58 of the 59 seats - although later, analysts suggested the party could take all 59.
Elsewhere, the Conservatives held on to the key marginal seat of Nuneaton, a target seat for the Labour party.
Earlier in the evening, Alexander had tweeted his thanks to his followers.
"Thank you to everyone who campaigned for Labour today. Great to see so many people out working for a Labour government".
Stay up to date with tonight's results with our live map.