12 And I saw the dead, great and small, standing before the throne, and books were opened. Then another book was opened, which is the book of life. And the dead were judged by what was written in the books, according to what they had done.
13 And the sea gave up the dead who were in it, Death and Hades gave up the dead who were in them, and they were judged, each one of them, according to what they had done.
14 Then Death and Hades were thrown into the lake of fire. This is the second death, the lake of fire.
15 And if anyone's name was not found written in the book of life, he was thrown into the lake of fire (Rev 13:8; 17:8; 21:27)
28 Do not marvel at this, for an hour is coming when all who are in the tombs will hear his voice
29 and come out, those who have done good to the resurrection of life, and those who have done evil to the resurrection of judgment.
John 3:18 Whoever believes in him is not condemned, but whoever does not believe is condemned already, because he has not believed in the name of the only Son of God.
24 Truly, truly, I say to you, whoever hears my word and believes him who sent me has eternal life. He does not come into judgment, but has passed from death to life.
25 "Truly, truly, I say to you, an hour is coming, and is now here, when the dead will hear the voice of the Son of God, and those who hear will live.
John 6:29 Jesus answered them, "This is the work of God, that you believe in him whom he has sent."
Those who are destined for the lake of fire stand condemned based on the fact that their names were not written, (prior to creation), in the Lamb’s book of life. They must rely solely on their good works, i.e. their own righteousness. They may have even led their life by the highest moral standard, yet they fall woefully short. (Isaiah 64:6)
Those whose names are in the book of life, stand on the finished work of the Lamb alone. Their works, good or bad, have nothing to do with their salvation, that is, they are not judged by the content of any of the other books. If there was no such book written, (prior to creation), naming God’s elect in Christ, all men would be condemned. The elect are foreknown by God as He had decreed them to be elect, before creating a thing.
1 There is therefore now no condemnation for those who are in Christ Jesus……….
29 For those whom he foreknew he also predestined to be conformed to the image of his Son, in order that he might be the firstborn among many brothers.
30 And those whom he predestined he also called, and those whom he called he also justified, and those whom he justified he also glorified.
17 And if you call on him as Father who judges impartially according to each one's deeds, conduct yourselves with fear throughout the time of your exile,
18 knowing that you were ransomed from the futile ways inherited from your forefathers, not with perishable things such as silver or gold,
19 but with the precious blood of Christ, like that of a lamb without blemish or spot.
20 He was foreknown before the foundation of the world but was made manifest in the last times for the sake of you
21 who through him are believers in God, who raised him from the dead and gave him glory, so that your faith and hope are in God.
It’s the Father’s work in and through the Son, i.e. His righteousness imputed to the chosen, that is first. We then receive the gift of faith which causes us to believe, and which then brings about our obedience/”works”. (Romans 1:5; 16:26)