Ghosts, being spirits rather than living creatures, are not as bound to the physical realm as are most other pokémon. This accounts for many of their unique traits, as well as endowing them with some special abilities in battle. Ghosts are able to become invisible, turn incorporeal to pass through obstacles or avoid attacks, and even occupy solid objects for a small amount of time. These abilities are collectively known as "phasing."
The easiest ability for a ghost to use is its ability to become invisible. While invisible, a ghost retains all its normal weaknesses and resistances, but obviously is nearly impossible to hit because it cannot be seen. Unerring attacks like magical leaf will still be effective against invisible ghosts, and reliance on sound may still give an indication as to where a ghost is. Also, if a ghost uses any attack that makes it obvious where it's hiding--basically any projectile that is not invisible and would be seen to come from the ghost--invisibility is obviously of little help. Mind reader and lock on can be used to find an invisible ghost, as can scanning with psychic abilities. It costs a ghost 1% per action to remain invisible.
Ghosts may turn incorporeal in order to pass through solid objects or allow attacks to pass through them. In this form, a ghost can only be affected by energy-based (special) attacks and, in turn, can execute only attacks of this nature. Pokémon with the scrappy ability ignore this effect. Staying in a phased state requires no energy to maintain. However, if a ghost is phased and then tries to occupy a space taken up by a solid object for any more than a single action, it counts as "possesssing" that object and different rules apply.
Possession requires energy to maintain (2% per action). Anything on the field, including enemy pokémon, can be possessed. While possessing something, the ghost is diffused throughout its form and it naturally loses any physical abilities that it might have. It is also blind, deaf, and dumb, as it no longer has the necessary organs to obtain these sensory inputs. A trainer should therefore be wary; there is no way for a ghost to receive its trainer's orders. Therefore, any actions for the ghost to take while possessing an object must be ordered ahead of time. The ghost will by default rematerialize after it has completed them unless somehow prevented from doing so.
While in possession of an object, the ghost is at a disconnect with the material world; it cannot actually influence the actions of the host, if any. It is restricted to using special or energy-based attacks, and is further restricted in that these attacks cannot require body parts, such as a mouth or tongue, to use. However, a ghost is safe from anything but energy damage when in this state as well, and attacks that work by sight or sound cannot affect them. However, even ambient energy that would normally not affect the host can damage a ghost within it. For example, an electric-type's cells are naturally immune to the current they generate. However, a possessing ghost-type would be negatively affected by the buildup of charge when possessing such a pokémon. An attack like spark, which merely discharges electricity from the surface of the body, would not affect a possessing ghost. However, an attack like charge, which increases the level of electricity in the pokémon's body, would. Similarly, flamethrower does not affect a posessing ghost, but if it was inside a pokémon that used overheat, it would certainly be uncomfortable.
Phsyical damage to the pokémon or object being possessed has no effect, as the ghost's "cells" are gaseous and merely slide through whatever medium is undergoing stress without sustaining damage. For example, if a ghost is inside a rock affected by an earthquake attack, it will not take damage. However, if an energy-based attack is able to penetrate the object being possessed deeply enough, then the ghost may take damage.
Attacks that rely on a rush of energy to expel unwanted status effects, such as refresh or rest, will also drive out resident ghosts. If knocked out while posessing an object, a ghost will automatically rematerialize in order to be recalled.
There are some ghosts that are tied to physical objects in one way or another and therefore cannot phase completely. These include sableye (gems), shedinja (shell), and spiritomb (keystone). These pokémon can still phase as normal, but these physical objects will be unaffected and still susceptible to normal damage. For example, sableye can turn its body invisible, but the gems apparently floating in midair are liable to give its position away. Pokémon made ghost-type through means other than dying do not have access to phasing abilities.
Ghosts can be locked into the physical realm through the use of the attacks odor sleuth and foresight, which make them unable to use their phasing abilities for the duration of the effect. If these commands are used to identify a ghost while it is possessing something, it will be trapped in that object until the effect fades.