Ensure your operating system is kept up to date.
Most attacks use known security "holes" or weaknesses in an operating system. Usually, as soon as these vulnerabilities are known about a "patch" or update is released in order to close the security hole.
Patches are available directly from the Microsoft Windows Update site, at http://windowsupdate.microsoft.com/
Follow the on-line instructions on how to update your system. By applying the security updates you will help prevent vulnerabilities in your system being exploited, and prevent viruses from running on your system.
If you're using Windows 7 or above, you can use the Windows Update feature which is built into the operating system to get all the latest security updates. Simply click Start and then select Windows Update. Whenever the PC is connected to the internet, it will automatically check for, and download the updates as and when they are released by Microsoft. If the connection is terminated before the file(s) are fully downloaded, they will automatically continue, the next time the connection is made.