That is caused by specific advertising services from within specific apps. They are called push ads and airpush is the biggest offender of them. You can opt out on their website by providing your IMEI or by paying them money, although I'm pretty sure that you can just go their website and opt out now. As those are the old methods, they may have updated it.
Personally, I would never use the airpush service in my apps. I would be satisfied with using regular built-in apps. I would say that only greedy developers use airpush.
Just press and hold that notification/spam message for a few secs, and it pops up "App Info" where you can know which app is doing such spam. I would immediately remove that app!