Just as in English, Spanish verbs can be accompanied by direct and indirect objects. A direct object is the noun or pronoun that the verb acts directly on, while an indirect object is the person affected by the action but not acted directly upon. In a sentence such as "I see Sam," "Sam" is the direct object of "see" because "Sam" is the object that seen. But in a sentence such as "I am writing Sam a letter," "Sam" is the indirect object. The item being written is "letter," so "letter" is the direct object. "Sam" is the indirect object as one who is affected by the verb's action on the direct object.
If you're learning Spanish, the distinction can be important to make because Spanish, unlike English, sometimes uses different pronouns for direct and indirect objects.
It is also important to note that many Spanish sentences use indirect-object pronouns where a different construction is used in English. For example, me pintó la casa would typically be translated as "he painted the house for me." In fact, one sign of an indirect object in English is that usually can be understood, to use "me" as an example, as "for me" or "to me." For instance, "he bought her the ring" is the same as "he bought the ring for her." In that first sentence, "her" is an indirect object. (The Spanish equivalent would be él le compró el anillo.)
Here are the indirect-object pronouns along with their English equivalents and examples of their uses:
- me — me — Juan me da una camisa. John is giving me a shirt.
- te — you (singular familiar) — Juan te da una camisa. John is giving you a shirt.
- le — you (singular formal), him, her — Juan le da una camisa a usted. John is giving you a shirt. Juan le da una camisa a él. John is giving him a shirt. Juan le da una camisa a ella. John is giving her a shirt.
- nos — us — María nos da unas camisas. Mary is giving us some shirts.
- os — you (plural familiar) — María os da unas camisas. Mary is giving you some shirts.
- les — you (plural formal), them — María les da unas camisas. Mary is giving you some shirts, or Mary is giving them some shirts.
As some of the above examples indicate, an indirect-object pronoun is required whenever a sentence includes an indirect object. A further clause can be added for clarity or emphasis, but, unlike in English, an indirect pronoun is still required. For example, le escribí could mean "I wrote to him," "I wrote to her" or "I wrote to you," depending on the context. To clarify, we can add a prepositional phrase, as in le escribí a ella for "I wrote to her." Note that le is still required, even though a ella makes it redundant.
Both direct- and indirect-object pronouns are typically placed before conjugated verbs, as in the above examples. They can be (but don't have to be) attached to infinitives and present participles: Te voy a escribir una carta and voy a escribirte una carta (I am going to write a you a letter) are both correct, as are le estoy comprando un coche and estoy comprándole un coche (I am buying him a car).
In commands, direct and/or indirect objects are attached to affirmative commands but precede negative commands. Escríbeme (write me), but no me escribas (don't write me).
Note that in affirmative commands and when attaching an object to a present participle, attaching the object at the end of the verb can result in an accent being needed to keep the stress on the correct syllable.
If you have a direct object and an indirect object with the same verb, the indirect object comes first. Te las escribo. (I am writing them to you.)

