Google's proprietary replacement for the stock Android dialer app can now not only tell you when a call may be spam, but even block it without any input from you. This feature is not on by default, since some businesses' legitimate calls can be filtered. Those who know that they won't be engaging with any such businesses, however, can turn the feature on and expect to see no hint of any spam calls interrupting their day. Voicemails and call log entries from spammers will still come up, but the calls won't cause any immediate interruption, and you won't get the persistent voicemail notification unless you have voicemails in your inbox from unfiltered callers.
You can toggle both this feature and the caller ID and spam protection features it's based on from the same menu. Just go into the phone app, then tap on the three-dot menu icon and go into the app's Settings menu. From there, go to Caller ID & Spam to find the settings you need. You can have no filter and ID at all if you wish, or you can automatically filter incoming calls from suspected spammers. It should be noted, however, that the latter feature is dependent upon the first, and can't operate without it. Furthermore, manually marking callers as spam will not get their calls automatically blocked unless you have both of these features turned on.
Google's phone app has identified suspected spam callers for some time, and a number of other apps have a similar function. Even so, this is one of the simplest ways to implement a call blocker into your device, and gets you the other nifty features of Google's dialer app as well. These features include things like video calls from right within the default dialer, a search function, and the ability to create default quick responses for when you're busy, among a wide range of other features. Aside from that, it's mostly similar to the AOSP dialer included with vaniall Android in most respects. Some phones come with Google's version of the phone app by default, but most will need to grab it from the Play Store and enable it as the default dialer app.