The letter of the law refers to the literal meaning of a law or any other kind of rule. The spirit, on the other hand, relates to its underlying meaning. So let's say, for example, that a park prohibits the use of vehicles. On a literal interpretation—the letter of the law—that would include roller skates, bicycles, or scooters. But if we interpreted that rule according to its spirit, one could argue that it was designed to apply to cars, vans, and trucks.
Of their very nature, rules can't be too rigid; they need to be applied in different contexts in order to work properly. Otherwise, they become impossible to follow and so end up falling into disrepute. This principle applies especially to rules of interpreting certain passages from the Bible. When Genesis states that God made the world in six days, are we to interpret that literally as Christian fundamentalists do, or do we instead read a deeper, more symbolic meaning into the text? In this particular example, the letter of the law could be regarded as inadequate as it flatly contradicts what science has been able to tell us about the creation of the universe. So then we look instead to the spirit of the text for a more accurate interpretation.