The SNP have held the Perth and North Perthshire constituency by a 66-vote margin.
Voters braved the rain in the battleground constituency to re-elect Pete Wishart, who has held the seat since 2005.
The former Runrig keyboardist received 21, 804 votes. Wishart is Scotland’s longest-serving MP, having first been elected in 2001 to the predecessor constituency.
It was a narrow loss for Ian Duncan, Scotland’s Conservative MEP, who gained 21,738 votes.
The constituency was established in 2005 to cover a northern portion of the Perth and Kinross council.
It was once a Conservative stronghold, but fell to the SNP when John Swinney was elected in 1997. The Conservatives were confident they could win back the seat after taking control of Perth and Kinross Council in last month’s Scottish local government elections.
The area comprises livestock and fruit-growing industries. A large part of the local economy is boosted by tourism in areas such as Pitlochry and Aberfeldy.
The city of Perth is largely affluent with some deprived areas and a city centre in need of regeneration.
The SNP have suffered losses across the country but remain the largest party. The decline in popularity is thought to be due to the possibility of a second Independence referendum, which dissuaded some former SNP voters.