Heb 12:22, 23 - But you have come to Mount Zion, and the city of the living God, the heavenly Jerusalem, and to myriads of angels, and to the assembly, to the church of the firstborn having been enrolled in the heavens, and to God the judge of all, and to the spirits of the righteous having been perfected
The first obvious thing about this passage is that it cannot be literally and physically true, for the very simple reason that the living saints, at the time it was written, were not literally on either the earthly Mt Zion or in the heavenly New Jerusalem.
Therefore, we must either understand this in either a metaphoric or spiritual sense.
The simplest way to understand this passage is by reference to a number of other passages with similar ideas about meeting with others such as:
- Col 2:5 - For although I am absent from you in body, I am present with you in spirit, and I delight to see your orderly condition and firm faith in Christ.
- 1 Cor 5:3 - Although I am absent from you in body, I am present with you in spirit, and I have already pronounced judgment on the one who did this, just as if I were present.
- 1 Cor 5:4 - When you are assembled in the name of our Lord Jesus and I am with you in spirit, along with the power of the Lord Jesus,
- Phil 1:27 - Only conduct yourselves worthily of the gospel of Christ, so that, whether having come and having seen you, or being absent, I might hear the things concerning you, that you are standing firm in one spirit, striving together with one mind for the faith of the gospel
Thus, one of the varieties of meanings of the word "spirit" (pneuma BDAG lists 8 meanings and many sub-meanings) is an attitude of mind, BDAG meaning #3 b & c.
The other tricky word in the word translated "perfected" can mean, "mature", "complete", "perfected", "finish", etc. The question here is, What does it mean in Heb 12:23?
The meaning "complete" or "finish" is common as in Luke 2:43, 13:32, John 4:34, 5:36, 17:4, 19:28, etc. It is this meaning that also appears in Hebrews such as:
- Heb 2:10 - For it was fitting to Him, for whom are all things and by whom are all things, having brought many sons to glory, to make complete the author of their salvation through sufferings.
- Heb 5:8, 9 - Although He was a Son, He learned obedience from what He suffered. And having been made complete, He became the source of eternal salvation to all who obey Him
See also Heb 7:28. Thus, Heb 12:23 appears to be saying that we are part of the entire historical assembly of saints who are spiritually gathered - we gather at the heavenly Mt Zion (compare Eph 2:6 - "we are seated in heavenly places") in the continuing spirit of all who have gone before, including those who have "completed their race" (2 Tim 4:7, Acts 20:24, etc).
Now, whether man has a separate immaterial part is another question that depends on other information but not in this verse.