Probably Agave Schottii, depending on where you were hiking.
Others go by that common name, but Schott's is the one I'll always remember. My attention was distracted for just a second. OUCH. After backing away, I saw that my pants were unscathed, and the tip that poked me was completely intact, so I kept going. A minute later I looked down to see my entire lower pants leg saturated with blood. I lifted my pants and saw the blood pumping out a nice, neat hole in my shin. Fortunately, 30 seconds of firm pressure was enough to stop it.