It is not only the Prophetic books of the Bible which contains prophecies. All books in the Bible have prophecies. Even the Psalms.
This psalm is a prophetic portrait of the death of Jesus Christ on the Cross. It is a harrowing description of the circumstances surrounding His passion and it contains an exhortation to those who read it to fear and praise the Lord.
Many have wondered how the prophets saw their prophecies, and whether or not they knew they were prophesying. For instance, when David wrote this psalm, did he know he was speaking of the suffering Messiah? The Scriptures state that sometimes they did not know or fully understand the mysteries they spoke. Whether the prophet received the vision in a dream, in a waking vision, or was transported to another time and place is unclear, what is clear is that very often the mystery revealed to them was amazing, awe-inspiring, and sometimes hard to believe. The prophet Isaiah declares in Isaiah 53 -- a chapter that aligns well with this psalm-- "Who has believed our report?"
Psalm 22 is a report -- almost like a coroner's snapshot-- of the incidents surrounding Jesus Crucifixion, except that it was reported centuries before Jesus' death. Prophecies tend to collapse time and connect the present with the future.
David --"in spirit" (as Jesus said)-- spoke of the method of crucifixion, the gambling for the Lord's clothing, and even the vinegar Jesus Christ was given to soothe the pain. He spoke all this when none in the Middle East were aware of crucifixion. But more agonizingly, he spoke of the gruelling passion the Lord Jesus endured to save the world and the despairing outcry He shouted to God when the sins of the world separated Him from God.
But, like Isaiah 53, it also promises that the suffering Messiah will also triumph and will create a unique people to praise Him.
30A seed shall serve him; it shall be accounted to the Lord for a generation.
31They shall come, and shall declare his righteousness unto a people that shall be born, that he hath done this.