The seat had been a key target for the Conservatives in Scotland, with the Tories desperate to defeat the SNP’s Westminster leader.
Mr Robertson said: “There’s been a lot of developments going on in the UK general election. It seems to me there’s a lot of change going on. People are seeking answers to the complex questions that we all face.
“I’m no longer going to be a member of parliament so I’m not going to play the same direct role. I’m confident the SNP is going to win the general election in Scotland and I wish my colleagues all the best.”
The Conservatives also won East Renfrewshire and Aberdeen South from the SNP, with their vote up 19 points in the latter constituency. In another shock, they won Ayr, Carrick and Cumnock, with their vote increasing by 20 points compared to 2015.
In a series of further surprises, Labour won back from the SNP Gordon Brown’s former seat of Kirkcaldy, Midlothian and Rutherglen and Hamilton West, following huge swings away from the Nationalists.
The SNP’s John Nicolson lost Dunbartonshire East to the Liberal Democrat’s Jo Swinson, a former minister.
In a rare bright moment for the Nationalists, Pete Wishart unexpectedly managed to hold Perth and North Perthshire by only 21 votes from the Tories, following a recount.