The Liberal Democrats held off strong opposition from the SNP to hold Shetland.
SNP candidate Tom Wills won 3,822 votes, with a 14.4 per cent swing from the Lib Dems to the SNP.
But Beatrice Wishart triumphed with 5,659 votes, making history by becoming the first female parliamentarian elected to represent the area.
Ms Wishart said she was honoured to “to make a little bit of history by becoming the first female parliamentarian in Shetland” after the “roller coaster” campaign.
“Over the past few weeks I’ve been to every corner of Shetland, speaking to people about the challenges they and their communities face and I’m proud of the positive campaign the Liberal Democrats have run.
“My work will start on Monday to get the Scottish Government to take action on its empty promises for fair ferry funding, to improve nursery provision, mental health care, broadband – the key strands of my positive campaign for Shetland.”
Alistair Carmichael, the Liberal Democrat MP for Orkney and Shetland, said Ms Wishart had fought a “fantastic campaign”.
“There’s no doubt she will be a first rate member of the Scottish Parliament for Shetland,” he added.
“This must be a bitter disappointment for the Scottish Nationalists.
“Just last week Nicola Sturgeon was here for her third visit in a month, telling us it was going to be neck and neck.
“If that was neck and neck, all I can say is that’s some neck.”
The former Scottish secretary added: “I think people in Shetland were threatened by the SNP, they sought to misrepresent the fantastic work that Tavish Scott did for Shetland over 20 years, and I think they have frankly had a pretty harsh judgement.”