Numbers 25:3-13:

And Israel joined himself unto Baal-peor: and the anger of the LORD was kindled against Israel.
And the LORD said unto Moses, Take all the heads of the people, and hang them up before the LORD against the sun, that the fierce anger of the LORD may be turned away from Israel.
And Moses said unto the judges of Israel, Slay ye every one his men that were joined unto Baal-peor.
And, behold, one of the children of Israel came and brought unto his brethren a Midianitish woman in the sight of Moses, and in the sight of all the congregation of the children of Israel, who were weeping before the door of the tabernacle of the congregation.
And when Phinehas, the son of Eleazar, the son of Aaron, the priest, saw it, he rose up from among the congregation, and took a javelin in his hand;
And he went after the man of Israel into the tent, and thrust both of them through, the man of Israel, and the woman through her belly.  So the plague was stayed from the children of Israel.
And those that died in the plague were twenty and four thousand.
And the LORD spake unto Moses, saying,
Phinehas, the son of Eleazar, the son of Aaron the priest, hath turned my wrath away from the children of Israel, while he was zealous for my sake among them, that I consumed not the children of Israel in my jealousy.
Wherefore say, Behold, I give unto him my covenant of peace:
And he shall have it, and his seed after him, even the covenant of an everlasting priesthood; because he was zealous for his God, and made an atonement for the children of Israel.

Notes on Numbers 25:3-13:

Sooner or later, some unbelieving smart-aleck will try to torment you with the idea that the Bible contradicts itself because 1 Corinthians 10:8 says that 23,000 fell in one day and the passage above in Numbers says that 24,000 died in the plague.  But if you think about this for a moment, there is no contradiction at all between the idea of 23,000 dying in a single day and 24,000 dying altogether.  Obviously the 1,000 others did not die the same day that the 23,000 died.

See also:

Healing and Atonement
God’s Blessing on Your Kids
Sickness as Chastening and Judgment in the Old Testament