Blessed [be] the Lord
A form of thanksgiving, in which the psalmist calls upon himself and others to bless and praise the Lord for the singular mercy granted him, expressed in the next clause; (See Gill on Psalms 18:46);
for he hath showed me his marvellous kindness in a strong city;
either in the city Keilah, so Jarchi; a city which had gates and bars, where Saul thought he had David safe, and he could not escape his hands; but notwithstanding that, and though the inhabitants of that place intended to deliver him up, yet he was marvellously saved; as he also was from the Ziphites; and when Saul and his army had encompassed him about, by a surprising incident, a messenger coming to Saul just as he was about to seize him, informing him that the Philistines had invaded the land, ( 1 Samuel 23:7-29 ) . Or the city of Jerusalem, which was fortified both by nature and art, whither he was brought and placed as king, and enjoyed rest from all his enemies round about him, ( 2 Samuel 5:6-9 ) ( 7:1 ) . Or this may spiritually design the church of God, which is called a strong city, being built on Christ the Rock, and having salvation for walls and bulwarks, ( Isaiah 26:1 ) : where the Lord displays his banner of love, makes discoveries of his marvellous kindness, and commands his blessing for evermore. Some render it "as in a strong city" F7, and take the sense to be, that he was safe, through the kindness of God showed to him in the salvation of him, as if he was in a fortified city F8, and this was marvellous in his eyes, as every instance of providential goodness is to the people of God; especially his lovingkindness showed in spiritual things, in choosing them in Christ, saving them by him, regenerating them by his Spirit, and taking them into his family; which love is free and sovereign, distinguishing, unchangeable, from everlasting to everlasting; and so wonderful and astonishing; and which was hid in God until revealed; and sometimes the manifestations of it are withdrawn, and then it is showed again, and fresh discoveries of it are made, and effects of it applied, and the blessings of it bestowed, which occasion thankfulness.