People tend to come down hard on Lot for offering his virgin daughters to the rapacious mob in Sodom in substitution for the angels he was sheltering in his home, but they often overlook a crucial detail in Genesis 19:6: when he went out to cut that deal, he closed the door behind him, thus cutting off his one escape to safety in the very likely event that the mob rejected his offer just to protect his two guests that he didn't even know at the time were angels. If they hadn't turned out to be angels, he really would have been screwed in more ways than one. Say what you will about him, Lot did put his own life and limbs on the line ahead of anyone else.
Jesus is the archetype of this character, though he's obviously not the first to have done so. Jesus had the advantage of knowing what was after death, and that he was going to sit at God's right hand... but he also knew he had to go through excruciating pain. This is even more starkly illustrated by His stating the line quoted below when discussing the subject, rather than something about the horrifying physical pain one would endure when dying of asphyxiation and blood loss during the crucifixion process, to the point where a word was made specifically to describe such pain: excruciating, or "out of the cross." In other words, the pain involved in his sacrifice was so much worse than torture that words could not describe it.
"Greater love has no one than this: to lay down one’s life for one’s friends."John 15:13
Samson combined this with Taking You with Me in a spectacularly epic fashion. He is captured by the Philistines and blinded, then put on public display in the temple. After praying to God to give him back his strength for a last time so he can go down honorably, he proceeds to tear down the pillars of said temple with his hands, crushing both himself and the Philistines and making this Older Than Feudalism (this being The Bible), as well as his Moment of Awesome. When he destroyed the Philistine temple, with himself and his enemies in it. With that one act, he killed more Philistines than in the rest of his life put together.
A divine being helping humanity through self-sacrifice has been an enduring theme in religion and mythology. See Prometheus, doomed to be chained for eternity with an eagle devouring his entrails as punishment for giving mortals the gift of fire. Although he was eventually freed by Hercules after a few thousand years. Legends say that even then, his punishment meant Prometheus had to wear a wreath and a ring of his chains for all eternity- and in respect, humans began wearing wreaths and rings as well.
The Book of Mormon, one of the four parts to LDS ("Mormons") scripture, tells the story of a prophet named Abinadi. King Noah was wicked: he and his priests committed murder and whoredoms and reveled in his riches, among other things, so Abinadi went to King Noah and told him that what he was doing is wrong, and that he needed to set things straight and repent. King Noah and his priests didn't listen and had Abinadi thrown out after warning him not to return. Rather than giving up and leaving, Abinadi returns in disguise and tells him his message again. The wicked priests try to kill him, but find that they cannot, and Abinadi says that they cannot harm him until he has finished saying what he came to say. After he finished, they burnt him to death, and while he is burnt to death, he prophecies that King Noah will also be burnt, which comes true. His death wasn't for naught, however, because one of the king's priests, Alma, listened to what Abinadi had to say, and then ran away from King Noah and repented. He alone helped thousands of people to find God, and many of the people who were righteous because of him converted thousands more.
Pre-"Vatican II" Catholic theology considered suicide by someone in their right mind to be an all-but-guarantied ticket to Hell…but the Principle of Dual effect held that if someone sacrificed their life to save others' because they could think of no other way—for example, the soldier who throws his (it was always 'his' back then) body on a grenade to save his comrades—they were not guilty of suicide.