Microsoft has a good article here on the basics of Spyware and how you can protect yourself from it.
Here is the introduction take verbatim from Microsoft's website. Read the whole article here.
What is spyware?
Spyware is software that collects personal information from you without first letting you know what it's doing and without letting you decide whether this is OK or not. The information spyware collects can range from all the Web sites you visit to more sensitive information like usernames and passwords. You might be the target of spyware if you download music from file-sharing programs, free games from sites you don't trust, or other software programs from an unknown source.
Spyware is often associated with software that displays advertisements, called adware. Some advertisers may covertly install adware on your system and generate a stream of unsolicited advertisements that can clutter your desktop and affect your productivity. The advertisements may also contain pornographic or other material that you might find inappropriate. The extra processing required to track you or to display advertisements can tax your computer and hurt your system performance.
This is not to say that all software which provides ads or tracks your online activities is bad. If you sign up for a free music service and in return for that free service the company offers you targeted advertisements, it might be a fair tradeoff. Likewise, tracking online activities can be useful when displaying customized search content or personalized preferences at an online retailer.
The key is whether or not you (or another user of your computer) have been properly notified of what the software will do and that you have provided consent to have that software installed on your computer. In other words, is the software being deceptive in what it does or how it gets onto your computer? [1]
[1] - Microsoft Website: What you should know about spyware