Of course, the trick is HITTING the damned thing with the pepper spray. Mountain lions are fast and stealthy. They have also been known to stalk people, unlike bears that are a threat if surprised or protecting cubs, but otherwise highly unlikely to track you down. In many cases of a mountain lion attack on a human, the victim had no clue as to what was happening until the cat pounced. Usually, a mountain lion will aim for the head or neck, trying to puncture the jugular or break the spine. Nice thought. Bad kitty.
Unlike bears, however, mountain lions have to take a human seriously, because a human may outweigh the 100 to 120 pound cat. So they can be bluffed. If you spot a mountain lion, stand as tall as you can, stick out your arms to appear larger, and talk loudly and aggressively. Throw rocks and sticks if you can. Do NOT run or turn your back. If anything, threaten the mountain lion by appearing to advance toward it. (Word of caution: Don't advance far.) And of course, have your pepper spray at the ready.
If attacked unexpectedly, fight back. If you can put up a hard struggle for even a few seconds, the mountain lion will likely decide you're not worth the trouble.
Incidentally, dogs are of little help and may even attract a big cat. Also, small children are especially attractive to mountain lions, so use caution when hiking with children in lion country. Stay in a small group, and be on the lookout.