Android forces app developers to categorize notifications (the API is called notification channels). Each channel can be muted individually in the system settings. Though it's up to the app makers to correctly categorize their notifications, in my experience most apps do this.
Whenever I see a spam notification, I immediatelly go mute the channel and the problem never repeats itself.