I would bet bear spray works great against a curious or young bear. I’ll bet it makes an aggresive bear bent on attacking really mad.
What I have observed, in studying the subject, is bears who are seeing a person as prey, are not as concerned with bear spray. They retreat, but then they come back, sometimes multiple times. If a bear keeps coming back, it is likely interested in you as prey. One of the great advantages of firearms is the bear is usually killed. Then it cannot come back, and is removed from the gene pool.
As bears who have a tendency to view people as prey are removed from the gene pool, bears who avoid people tend to dominate the gene pool. All species of bears in North America have shown this effect. Even polar bears were commonly avoiding human hunters by 1914.