Scotland secured a place at the men's World Cup for the first time since 1998 as stoppage-time goals by Kieran Tierney and Kenny McLean secured a thrilling 4-2 win over Denmark at Hampden Park.