It's already a work-in-progress. Stack Exchange is using a bot called SmokeDetector (affectionately known as Smokey) which goes through some fairly complex rules to detect spam. You can visit it here:
It currently merely detects, and (if requested) sends a message to anyone who subscribes. Subscribed members can then flag the spam for moderator attention, or moderators can delete it immediately.
It does get things wrong from time to time, so that is why it doesn't automatically delete spam. For example, on the English Language part of SE recently, someone asked about expletives (eg. f--k) which were picked up by Smokey as as "offensive text detected in body of post". However in this case it was a legitimate post enquiring about whether certain expletives were appropriate in writing a novel.
Of course, there are other posts using words like that which are just for dating-site spam.
Training Smokey is an ongoing effort by a fairly dedicated team of coders. :)
Probably the closest you could get to automating things would be for a number of users, who are frequently logged on, to subscribe to the notifications. Then they could quickly flag as spam such posts.
As I write this, I got a couple of notifications from Smokey. One was an hour ago and one 55 minutes ago (I was eating dinner at the time). In that time the community had already flagged it, and it was automatically deleted due to the number of flags. So the current system works reasonably well.
Shortly afterwards I got a notification from Smokey. After only 22 seconds, a post had two downvotes. After 1 minute it had 4 downvotes. I had to hurry to delete it before the system got to it first. :)
Don't downvote spam: flag it as spam - that activates the Stack Exchange automated system.