Learn every map that you play on. Know them inside out and backwards. Know them from either team's side and every secret. To a spy, knowlege is power, and if you know where every shadow is, and every good gun placement spot is, you will be prepared for everything. Anticipate ambush zones and eliminate them with gas.
Engineers use it all the time.
Lone Engineers are no threat. The railgun does a LOT of damage against light armor. Luckily, most Engineers can't aim. Change skin often. Never go in with the same skin twice.