Spam -- whether in a post, comment or through a contact form -- has become a troublesome fact of life for any site administrator. Fortunately, a number of modules help stem the tide of spam, either by real-time filtering, challenge-response interaction, or a combination of the two.
One common method of preventing automated spam postings is to employ a module that injects a CAPTCHA into common Drupal forms, like the user registration, comment and contact pages. If the CAPTCHA, a visual or auditory challenge, can be completed with the correct response, the user is assumed to be human and not an automated spam-posting process. See the CAPTCHA and ReCAPTCHA documentation or project pages for two modules that provide this functionality.
Mollom is a popular spam filtering service that analyzes content in real-time for spam-like characteristics. Content identified as spam is blocked, while clean content is processed normally. If Mollom is unsure whether the content is spam, it directs your site to require a successful CAPTCHA completion before the post is accepted. For filtering without any external services, the Spam module integrates a Bayesian filter along with some other filtering methods.
Some spam control modules are listed below; you can also search for spam prevention modules on drupal.org.