De is one of the most common prepositions in Spanish. Although it usually is translated as "of," and sometimes as "from," its use is far more versatile than the translation might suggest. In fact, in certain contexts, de can be translated not only as "of" or "from," but as "with," "by," or "in," among other words, or not translated at all.
One reason de is used more often than its equivalents in English is because the rules of English grammar let us use all sorts of nouns and phrases as adjectives. In that way, Spanish isn't quite so flexible. While in English we may say, "a nine-year-old girl," in Spanish that becomes una muchacha de nueve años or, literally, "a girl of nine years." Similarly, in English, we may say something like "a silver ring," using what is normally a noun, "silver," as an adjective. But in Spanish we have to say un anillo de plata, or "a ring of silver."
De also is used in Spanish to indicate possession. We may talk about "John's shoe" in English, but in Spanish it's el zapato de Juan, or "the shoe of John."
Following are some of the most common uses of de:
Cause: Following an adjective, de can be used to indicate a cause. Estoy feliz de nuestra amistad, I am happy with our friendship; está cansada de jugar, she is tired of playing.
Origin: Often translated as "from," de can be used to indicate the origin of a person or thing. Soy de Arkansas, I'm from Arkansas; mi madre es de la India, my mother is from India; la chica más inteligente de la clase, the most intelligent girl in the class.
Characteristics: When an object or person has characteristics (including contents or what something is made of) that are stated as a noun or infinitive, de is often used to show the relationship. It generally is not possible in Spanish, as it is in English, to use nouns as adjectives. Corazón de oro, heart of gold; el tranvía de Boston, the Boston streetcar; una casa de huéspedes, a guesthouse; una canción de tres minutos, a three-minute song; una casa de $100,000, a $100,000 house; una taza de leche, a cup of milk; la mesa de escribir, the writing table; una casa de ladrillo, a brick house; jugo de manzana, apple juice; una máquina de escribir, a typewriter.
Comparisons: In some comparisons, de is used where we would use "than" in English. Tengo menos de cien libros, I have fewer than 100 books; gasta más dinero de lo que gana, he spends more money than he earns.
Idioms: De is used in a number of idiomatic phrases, many of which function as adverbs. De antemano, previously; de cuando en cuando, from time to time; de memoria, by memory; de moda, in style; de nuevo, again; de pronto, immediately; de prisa, hurriedly; de repente, suddenly; de todas formas, in any case; de veras, truly; de vez en cuando, from time to time.
Possession: Possession or belonging, either physical or figurative, as indicated by "'s" in English is almost always translated using de followed by the possessor in Spanish: el carro de Matilda, Matilda's car; la clase del Sr. Gómez, Mr. Gomez's class; las esperanzas del pueblo, the people's hopes; ¿De quién es este lápiz? Whose pencil is this?
Verbal expressions: Many verbs are followed by de and often an infinitive to form expressions. There is no logic to which verbs are followed by de. The verbs need either to be memorized or learned as you come across them. Acabo de salir, I have just left; nunca cesa de comer, he never stops eating; trataré de estudiar, I will try to study; me alegro de ganar, I am happy to win; se olvidó de estudiar, he forgot to study; Romeo se enamoró de Julieta, Romeo fell in love with Juliet.
You will also occasionally see other uses of de, although those above are the most common. There are also many expressions and verb combinations using de that were not listed above.
Keep in mind also that when de is followed by the article el, meaning "the," they form the contraction del. Thus los árboles del bosque is the equivalent of saying los árboles de el bosque ("the trees of the forest"). But no contraction is used for de él, which means "his."