All eight members of the squad for the four-a-side tournament – played with rolling substitutions – are either homeless, or have been homeless in the last two years.
They beat Romania 7-0 and Germany 15-2 before a 17-goal thriller in which they beat Poland 9-8 to qualify for the semi-finals. There they defeated Kenya 5-3 to make the final against Mexico.
William McLean, a dad-of-two from Edinburgh, scored first before Mexico equalised. The Scots went ahead again but, just before half-time, it was all equal again. In the second half, McLean scored twice more before Mexico netted a consolation goal in the dying seconds.
Manager Ally Dawson, a former Rangers defender, said: “I’m absolutely delighted for the whole team. They’ve all been through a lot in their lives and I hope they go on from this to achieve more success.”