Psa 18:6 In my distress I called upon the LORD; to my God I cried for help. From his temple he heard my voice, and my cry to him reached his ears.
Psalms 18:6 contains typically language associated with the functioning of prayer. Prayers ascend to God. God hears the prayers. Then God responds.
The same motif can be found regularly throughout the Bible: 2 Samuel 22:7, Psalms 34:6, Psalms 34:17, Isaiah 37:17, Daniel 9:17.