Source
This psalm reveals God's heart towards hwis own son in which people and kings of the earth are warned to serve God because the final judgment is in their hands.
In that order, it emphasizes the rebellion of men and their impious actions, which have no chance of succeeding, although they persevere in destroying the work of God, will not prosper.
Psalms 2
2 Why do the nations rise up,
and in vain do the peoples conspire?
2 The kings of the earth rebel;
rulers plot against the Lord
and against his anointed.
3 And they say, "Let's tear their chains to pieces!
Let us free ourselves from his yoke! "
4 The king of heaven laughs;
the Lord mocks them.
5 In his anger he rebukes them,
in his fury he intimidates them and says:
6 «I have established my king
on Zion, my holy mountain »...
(NIV)
The word used here as "messiah" is a transiliteration of the Hebrew which is translated here as anointed, in this case the anointed is probably a king of Israel who prophetically anticipates Christ the holy son of God whom he anointed.
Jesus was always aware that he was the son of God and it was this declaration that led the Jewish leaders to crucify him because he never denied him even in the darkest days that could pass on the face of the earth.
Verse 5 describes what God speaks and that is when the king publishes his decree as Jesus acknowledged having this power by commissioning his followers to go and make disciples of all nations.
In addition, this psalm contains a surprising declaration of all the nations of the world where they will come under the rule of the son a declaration revealed in David's spiritual vision about future times where God himself grants the church to be an intercessor of this promise for assume his glory and receive the inheritance of the nations as he promised
Reference: BP. RVR1960, comments.