A Commentary, Critical, Practical, and Explanatory on the Old and New Testaments, by Robert Jamieson, A.R. Fausset and David Brown  at sacred-texts.com
psa 87:1This triumphal song was probably occasioned by the same event as the forty-sixth [see on Psa 46:1, title]. The writer celebrates the glory of the Church, as the means of spiritual blessing to the nation. (Psa 87:1-7)
His--that is, God's
foundation--or, what He has founded, that is, Zion (Isa 14:32).
is in the holy mountains--the location of Zion, in the wide sense, for the capital, or Jerusalem, being on several hills.
psa 87:2gates--for the enclosures, or city to which they opened (Psa 9:14; Psa 122:2; compare Psa 132:13-14).
psa 87:3spoken of thee--or, "in thee," that is, the city of God (Psa 46:4; Psa 48:2).
psa 87:4This is what is spoken by God.
to them . . . me--literally, "for My knowers," they are true worshippers (Psa 36:10; Isa 19:21). These are mentioned as specimens.
this--that is, nation
was born there--Of each it is said, "This was born," or is a native of Zion, spiritually.
psa 87:5The writer resumes--
This and that man--literally, "man and man," or many (Gen 14:10; Exo 8:10, Exo 8:14), or all (Isa 44:5; Gal 3:28).
the highest . . . her--God is her protector.
psa 87:6The same idea is set forth under the figure of a register made by God (compare Isa 4:3).
psa 87:7As in a great procession of those thus written up, or registered, seeking Zion (Isa 2:3; Jer 50:5), "the singers" and "players," or pipers, shall precede.
all my springs--So each shall say, "All my sources of spiritual joy are in Thee" (Psa 46:4; Psa 84:6).