A spam filter analyses incoming mail — sender reputation, links and attachments — and moves suspicious messages to quarantine or the "spam" folder.
To protect your own domain, it's important to set up SPF, DKIM and DMARC records correctly: they help other mail servers spot fake emails sent in your domain's name.
Example
After DMARC is configured, fake emails sent in the company's name generally stop reaching customers' inboxes.