A direct object pronoun replaces a direct object, that is a noun that directly receives the action of a verb in a sentence. Moreover, direct object pronouns in Spanish agree in number and gender with the nouns they replace. In the sentence:
<em>Compro </em><em>la gasolina </em><em>en la estación de servicio</em>
<em>La gasolina</em> is the direct object because it receives the action comprar. Since <em>la gasolina </em>stands for the third person singular in feminine form, we need to use the direct object pronoun that matches this person, that is, la. Therefore, the new sentence is:
<em>La </em><em>compro en la estación de servicio</em>