Three words: Cool. Dark. Airtight.
Here’s the rationale: Light, heat and air are the enemies of aroma and flavor. Therefore, keep spices in tightly sealed glass jars or tins in a cool, dark pantry, cupboard or drawer. Do not keep them on a rack above the stove or anywhere near a heat source. Do not succumb to the temptation of displaying your spices on the kitchen counter: Yes, they are beautiful, but exposure to light and heat speeds deterioration.
And a fourth commandment: Buy whole spices.
As Harold McGee explains in On Food and Cooking, “the fine particles of ground spices have a large surface area and lose their aroma molecules to the air more rapidly, while whole spices retain the aromas within intact cells.”
So buy whole spices and grind them as needed. Toss ground spices after a few months. Properly stored whole spices can last a year or more, especially black peppercorns, nutmeg and fennel.
See Harold McGee, On Food and Cooking: The Science and Lore of the Kitchen, second edition, Scribner, 2004 at www.amazon.com.