How to protect WordPress from spam

Here are some tips on how to stop spam comments from being posted to your blog:

Activate the Akismet plugin (built-in with the WordPress installation package).
Go to the Plugins section of your Dashboard and follow the instructions for the Akismet plugin.

There are also other anti-spam plugins to prevent comment spam.
You can search for plugins through the WordPress site, or go to the Plugins section of your Dashboard.
You should also install a captcha plugin: WP-reCAPTCHA, Conditional CAPTCHA
as well as Project HoneyPot plugin: WP-HoneyPot or http:BL.

You can restrict users and control who can post comments using your Dashboard.
Log in to your admin panel and go to Settings > Discussion.
You can change approval settings, allow registered users to post comments, make a list of spam words or IP addresses used by spammers etc.
You can block IP addresses in the .htaccess file so no one will be able to view your blog.