I wouldn't call it spam; it is more like bot traffic.
The first thing you should do if you haven't done it already is to enable the option Bot filtering in the view configuration in your Admin section.This won't solve everything but at least will exclude some hits from known bots and spiders.
For the rest, since there is not an obvious source you should play detective a little bit and find patterns that will help you exclude this traffic.
Go to the direct traffic report (or select the direct traffic segment), select the affected page (usually home) and start changing the secondary dimension.
Dimensions worth checking are:
- Browser/Browser version
- Operative system/ OS versions
- Browser size
- ISP or Network domain
- Flash version
Open a second window with dates where you didn't have this issue so
you can compare
Depending on what you find you can either create a filter, a segment, or both.
Filter: If you find something concrete like a private ISP or very old versions of flash or a browser.
Segment: If what you find is not safe to filter because might exclude real users. Segments allow multiple conditions.
Here is an example of an actual segment I use for a similar issue
Note: If this is a direct attack to decimate your resources you should also take measures at a server level, either blocking it
from the htaccess or using a CDN. Your hosting provider should be able to help with this too.
If you need more specific instructions, you can find them in this guide: