Bear Spray is effective against Black Bears. It does work for Brown / Grizzly / Kodiaks but only for a limited time, and your bottle had better be full when you start spraying.
Be sure to position yourself upwind before you spray or you might incapacitate yourself as well as the bear.
Bear Spray is a very potent capsaicin formula, it is many times stronger than that allowed for Law Enforcement / Security / Prison use.
Broadly speaking I have never had much problem with Black Bears, and I worked in the wilderness for 26 years and lived there recreationally as well. I've never carried a firearm unless hunting. Generally I just charge them yelling loudly and they run away. However Black Bears will return after you chase them, usually trying to sneak from a different path than the first approach. They can be chased away multiple times though.
If you chase a bear, you MUST be very aggressive, run as fast as you think prudent but at least start chasing immediately when spotted as fast as you can before you slow to match their retreating speed. Generally they will not run as fast as they can* but just enough to avoid you, so you must be the aggressor. Continue yelling the entire time. If you have a noisemaker or tool (frying pan, axe) you can bang it against trees as you chase.
If the bear turns sideways to you, or you notice it's hackles are up, it may be reluctant to leave, possibly due to previous human contact and a reduction in it's natural fear of humans. In that case you should probably prepare to leave. You can decide to simply get up and move, or you can pack up camp. If you simply leave, the Bear will probably just eat whatever food is available, maybe have a nap, then leave, so you can return later to pack camp or stay as you see fit.
Black Bears are habitual creatures to a massive extent; if a bear has found food somewhere it will return there periodically in it's rounds forever until it dies, even if it never finds food there again. Choose your campsite accordingly.
I have confronted Black Bears maybe hundreds of times, unarmed every time, never had a problem chasing them. I carried but never used Bear Spray. But animals are individuals, and it's possible to encounter one who doesn't react the way most do. Mostly you want to be prepared for that bear.
Use of a firearm is quite effective, putting rounds in the dirt nearby is almost always all you need to do. There is no need to actually fire at the bear unless there is less than a few feet between you and the animal and you are in present danger.
Even if a Black Bear mauls you you are almost certainly going to survive as they do not persist. (I have a friend who was a hunting guide, we call him "Blackie". Guess why).
However, if you are attacked, the proper response is (and I quote) "... fight aggressively with any available weapon. ..."
Note that the above is only pertinent to Black Bears. Other large species of Bear in North America are very different beasts and are much more dangerous.
* Human athletes can do 4+ second 40 yards, a Black Bear can do a 4+ second football field. I have only seen Black Bears run at full speed a handful of times, usually older cubs who are still with siblings but moma has kicked them out, playing. No Black Bear has ever charged me. Be the first to do the charging.