The SNP has made big gains across Scotland, with Nicola Sturgeon saying the country had sent a "clear message" on a second independence referendum.
The party won 48 seats after securing 45% of the vote - 8.1% more than in the last general election in 2017, when it won 35 seats.
The SNP also defeated Liberal Democrat leader Jo Swinson in East Dunbartonshire.
Ms Sturgeon said the result had exceeded her expectations.
The Conservatives have won six seats, the Liberal Democrats four and Labour one.
Neale Hanvey's victory in Kirkcaldy and Cowdenbeath is counted as an SNP gain from Labour because he was on the ballot paper as an SNP candidate.
Mr Hanvey had been suspended by the party over allegations he made anti-Semitic posts on social media, and will sit as an independent MP.
After 59 of 59 seats
Scottish National Party
, +13 seats compared to 2017
, -7 seats compared to 2017
, +0 seats compared to 2017
, -6 seats compared to 2017
The Conservatives and Prime Minister Boris Johnson have won an overall majority across the UK after taking a string of former Labour strongholds in England and Wales.
Labour leader Jeremy Corbyn said it was a "very disappointing night for the Labour Party" and confirmed he would not lead the party into the next election.
The other main developments from Scotland's election night include:
- Liberal Democrat leader Jo Swinson narrowly lost her Dunbartonshire East seat to the SNP by just 149 votes
- Scottish Labour's Ian Murray held on to his seat in Edinburgh South as his party lost all of its other MPs.
- The SNP's Stephen Gethins lost to the Liberal Democrats in the UK's narrowest marginal seat, Fife North East.
Ms Sturgeon, the Scottish first minister, had already pledged to send a letter to the prime minister before Christmas requesting that Holyrood be given the power to hold indyref2.
Speaking at the Glasgow count, she said she would not pretend that everyone who voted for her party will necessarily support independence.
But she said it was a "clear endorsement Scotland should get to decide our future and not have it decided for us".
Ms Sturgeon added: "Scotland has sent a very clear message - we don't want a Boris Johnson government, we don't want to leave the EU.
"The results across the rest of the UK are grim but underlines the importance of Scotland having a choice.
"Boris Johnson has a mandate to take England out of the EU but he must accept that I have a mandate to give Scotland a choice for an alternative future."
Nicola Sturgeon says she won't pretend that every single person who voted SNP necessarily supports independence. But she will insist this result is a thumping endorsement of her demand for a second referendum.
She will make an official request in the next few days to be granted the legal power to hold an independence vote.
And we know that Boris Johnson will refuse, sparking a huge debate about whether the Conservatives are ignoring the democratic choice of Scottish voters.
It's a debate that can only escalate as we leave the EU - and one which may fuel support for independence itself.
Scottish Secretary Alister Jack, who held Dumfries and Galloway for the Conservatives, said more people cast votes for unionist parties in Scotland than for the SNP.
And he was adamant the prime minister should continue to block Ms Sturgeon's calls for power to hold an independence ballot.
The Conservative vote had fallen by 3.5% to 25.1% across Scotland, while the Labour vote was down by 8.5% to 18.6%. The Liberal Democrat vote actually increased by 2.8% to 9.5% despite the loss of the party's leader.
Rutherglen and Hamilton West was the first Scottish constituency to declare its result at 01:25, with Margaret Ferrier - who previously held the seat between 2015 and 2017 - polling 23,775 votes, giving her a majority of 5,230 over her Labour rival Ged Killen.
That early success was quickly followed by the SNP's David Doogan defeating Conservative Kirstene Hair in Angus.
John Nicolson won the Ochil and South Perthshire seat after defeating Luke Graham of the Conservatives, while the SNP also won back Midlothian from Labour's Danielle Rowley,
The SNP's Mhairi Black comfortably held her Paisley and Renfrewshire South seat with a greatly increased majority, while Kenny MacAskill, the former Scottish justice secretary, won the East Lothian seat from Labour.
SNP MEP Alyn Smith won Stirling from Stephen Kerr of the Conservatives, but Scottish Secretary Alister Jack held Dumfries and Galloway for the Tories.
Douglas Ross also held his Moray seat for the Conservatives, while his colleague David Mundell held Dumfriesshire, Clydesdale and Tweeddale.
The SNP's Stephen Gethins lost by 1,316 votes to Wendy Chamberlain of the Liberal Democrats in Fife North East. Mr Gethins had won the seat by just two votes in 2017.
And Labour's Ian Murray held on in Edinburgh South, meaning he is the party's only MP in Scotland.
Mr Murray, a longstanding critic of Mr Corbyn, warned that his party's ideology must change or else it will "die" and said voters he spoke to on the doorsteps during this campaign did not see Mr Corbyn as prime minister and could not see Labour as a credible alternative government.
For a nationwide breakdown of results, see our results page.
Or you can browse the A-Z list.
The SNP are once again the undoubted winners of the night, taking a slew of seats from their opponents including a big scalp in the form of Lib Dem leader Jo Swinson.
The party haven't had it all their own way - running up against Tory resistance in a few seats and losing North East Fife to the Lib Dems - but Nicola Sturgeon's team have piled on thousands of votes in every seat and have already secured a landslide.
Labour, meanwhile, have collapsed across Scotland, with their share of the vote down sharply. They even lost the shadow Scottish secretary, Lesley Laird, to a candidate disowned by the SNP and who will sit as an independent.
The Conservatives have clinched victory UK-wide, but have lost a clutch of Scottish seats to the SNP - and will be wondering what this means for their campaign to "stop indyref2".
The Lib Dem vote share is up in most places, but any progress will be massively overshadowed by the loss of Ms Swinson. The party's leader has just gone from touting herself as a future prime minister to losing her seat for the second time in four years.