The best way to protect your computer is to avoid downloading anything unless you are sure of the authenticity of the developing company or have read enough reviews about the product. It is like militarization of your Computer, however we all know that it is not possible to still remain immune. You might get an email from an acquaintance whose computer is infected and the attachment may also infect your computer without your knowledge.
Spyware are like spies in the real world, they would penetrate your system without your knowledge. It is important to frisk any piece of code that you allow to rest on your computer like you would check strangers coming into your office. Trust, but verify!