No, they weren't ghosts. As Sarge explained, everything we saw in seasons 1-6 was real. The final season initially tricked us into believing we were watching an alternate reality where the plane didn't crash. But the truth is that what we saw was an afterlife. It was decades or even centuries later (given that Hurley and Ben were close to immortal) and they had all died at various times and were waiting for the last of them to die to they could move on together. While waiting, they were given an opportunity to work out their issues.
They were in the ''in-between'' so yes, they were spirits or what have you and not actual physical beings. Much disappoint stirred up because of the ending.
This was explained in the final minutes of the finale episode by Christian Shephard (Jack’s dad). The original Oceanic 815 plane crash happened. Everything on the Island through seasons 1-6 happened. The “flash sideways” universe introduced in season 6 was a sort of stop-over point between life and afterlife.
For a more detailed answer, see the link below...
So I just finished watching the show LOST.. and I am now lost in how it ended.. were they all ghosts? phhhhhhhh cant I wasted all my time watching something that I wouldnt even understand.