Spirit, in the King James Old Testament, is usually derived from the Hebrew word ruach (Strong's Concordance #H7307). It can mean, among other things, a wind (Hosea 8:7), breath (Genesis 6:17) or mind (Genesis 26:35). The English word itself is recorded 244 times, with Isaiah utilizing it the most (37) followed by the prophet Ezekiel (26). The first recorded use of "spirit" is in the Bible's second verse.
And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit (ruach) of God moved upon the face of the waters (Genesis 1:2, KJV).
In the KJV New Testament, the word comes from the Greek pneuma (Strong's #G4151) that roughly means the same as ruach. It is found 261 times, with the book of 1Corinthians using it the most (35), followed by Romans (29) and Acts (24). Another roughly 98 occurrences of spirit should be added to this amount as the King James erroneously translates pneuma as "ghost" in many verses (Matthew 1:18, 20, 3:11, etc.).
Spirit is the substance that comprises God's existence (John 4:24). Angels were created to possess this type of "body" along with a mind able to think, make choices and build character (Hebrews 1:7, 1Peter 3:19). Together they live in an invisible dimension or realm that predates the physical universe (Job 38:4 - 7).
What about us?
All humans, although composed of flesh (the stuff of the physical universe), do possess a spiritual component that makes their life possible. This component, known as the "spirit in man" (Job 32:8, Zechariah 12:1, 1Corinthians 2:11), is given by God upon conception. It, in conjunction with our brain, gives us the power of mind. It grants us the capacity (unlike animals) to think, reason, learn, create, make choices, be self-aware and so on. It also functions as a recorder of all our thoughts and choices that form our character and make us who we are.
This spirit in humans is not immortal and is not conscious upon the death of the body (Ecclesiastes 9:5). When a person dies, it goes back to God who gave it (Ecclesiastes 12:7). Their spirit is kept, completely unaware of the passage of time, until the second resurrection where it is placed in a new physical body. The resurrected, which never had a full opportunity to understand God's truth, will now be offered repentance and a chance to live forever.
Not all humans, however, are destined for the second resurrection. Another spiritual component exists that offers the gift of rising from the dead at the return of Jesus!
When an individual is called to repentance and responds positively, they can receive God's Holy Spirit upon baptism. This spirit, which unites with the one a person already has, enables them to become a son or daughter of God (Romans 8:15, Galatians 4:6). It allows their minds to understanding the truth and empowers them to build righteous character as they live a life of overcoming and obedience. Those who remain faithful until death will then, at the Second Coming, be given new eternal bodies (1Corinthians 15:35 - 54) and will help rule the world for 1,000 years (Revelation 20:4, 6).