Hebrews 1:8-9 is directly quoting the Septuagint version of Psalm 45:6-7:
Psalm 44:6-7 LXX
ὁ θρόνος σου, ὁ θεός, εἰς αἰῶνα αἰῶνος,
ῥάβδος εὐθύτητος ἡ ῥάβδος τῆς βασιλείας σου.
ἠγάπησας δικαιοσύνην καὶ ἐμίσησας ἀνομίαν·
διὰ τοῦτο ἔχρισέν σε ὁ θεός, ὁ θεός σου,
ἔλαιον ἀγαλλιάσεως παρὰ τοὺς μετόχους σου.
Thy throne, O God, is for ever and ever: the sceptre of thy kingdom is a sceptre of righteousness, Thou hast loved righteousness, and
hated iniquity: therefore God, thy God, has anointed thee with the oil
of gladness beyond thy fellows.1
Hebrews 1:8–9
πρὸς δὲ τὸν υἱόν·
ὁ θρόνος σου, ὁ Θεός, εἰς τὸν αἰῶνα τοῦ αἰῶνος·
ῥάβδος εὐθύτητος ἡ ῥάβδος τῆς βασιλείας σου. ἠγάπησας δικαιοσύνην καὶ
ἐμίσησας ἀνομίαν· διὰ τοῦτο ἔχρισέ σε, ὁ Θεός, ὁ Θεός σου ἔλαιον
ἀγαλλιάσεως παρὰ τοὺς μετόχους σου·
But unto the Son he saith, Thy throne, O God, is for ever and ever: a sceptre of righteousness is the sceptre of thy kingdom. Thou hast
loved righteousness, and hated iniquity; therefore God, even thy God,
hath anointed thee with the oil of gladness above thy
fellows.2
Paul is providing a Christological interpretation of the Psalm, relating it to the anointing of Christ - which in Greek (Christos) means the anointed one - as King. Gladness is associated here because the Psalm itself is a commemoration of a wedding, wherein neither the king nor queen are named.
1 Brenton translation
2 King James Version (1900) translation