A spirit is a disembodied intelligent being. It is disembodied in the sense of not being composed of ordinary matter, and intelligent in the sense of being an agent that desires to do certain things.
Origin in folk psychology
The spirit can be seen as an artifact of an incorrect theory of mind. To our ancestors, things in the world could be divided into two categories: things that move about, breathe, and seem to act purposefully, such as people and animals; and things that don't, such as plants and stars. Just as importantly, a dead person or animal looks just like a living one, but does not breathe, walk, talk, or act in a purposeful manner.
From this, it is easy to conclude that there is something in a person or animal, separate from the body, that causes it to act the way it does in life. This spirit, then, contains all of the essential elements of life. Since breathing stops at death, the spirit may be somehow connected to it. And if the spirit is separate from the body, it may survive death.
While this notion may still be used poetically or metaphorically, as science has learned more and more about how living beings function, the notion of a spirit as a literal animating force has become untenable.
Even so, it can be seen in John 6:63 that Jesus's words are spirit. This could mean that spirit is a word for qi or that spirits are concepts. Spirits are usually associated as the source of conceptualism. The soul according to Jewish tradition is made up of the mind, will, and emotions. So, it could be that the spirit is another word for the mind. This would explain why the words for spirit and soul are interchangeable in all official English translations of the Bible.