SNP candidate Rob Munn won the Leith Walk ward from Labour, but the largest swing in the vote saw the Greens come second, pushing Labour into third.
Green candidate Lorna Slater won 25.5 per cent of first preference votes – up 5.8 per cent from 2017 – 741 behind the SNP, although the gap narrowed to 256 votes in the final round of the count.
Scottish Green Party co-convener Patrick Harvie said the result gives him confidence that the party can secure its first MEP at the European Parliament elections next month.
Mr Harvie said: “The result in Leith Walk is a tremendous lift for Greens ahead of European elections and huge credit goes to the brilliant Lorna Slater who ran a superb campaign.
“It’s clear that there’s strong support for our inspiring vision for rebuilding democracy, locally and across Europe, so that we can tackle the climate crisis, lift people out of poverty and create a welcoming society which rejects far-right populism.
“At the last European elections, Greens narrowly missed out on our first Scottish MEP to an extremist Ukip candidate whose campaign was flooded with cash and who was given a hugely disproportionate media platform.
“By making the positive case for Scotland’s place in Europe, we’re determined that won’t happen again.”
The UK looks set to participate in the European elections following the six-month extension to Article 50 granted by the EU.
Earlier this week, the UK Government tabled an order enabling elections to the European Parliament to be held in Britain if the country has not left the EU by the time they take place next month.
The Day of Poll Order sets the date for the elections on 23 May, but the Cabinet Office said they would automatically be cancelled if the UK left before then.
European elections are held every five years, with the UK electing 73 MEPs to sit in the 751-member Parliament in Brussels and Strasbourg.
Scotland elects six MEPs through proportional representation and in the 2014 election two SNP and two Labour representatives were chosen along with one Conservative and one Ukip MEP.