In Spanish the indirect object pronoun (me, te, le etc.) will come before the direct object pronoun (lo, la etc.), in structures such as in simple sentences, at the end of infinitives and directly on the end of imperative structures. For example, the English phrase 'You bought it for me', in which 'it' is an apple (una manzana), would be translated into Spanish as Me la compraste, as the indirect object pronoun 'me' means 'for me', and the direct object pronoun 'la' replaces una manzana, and therefore has to agree in terms of gender.
Other similar examples, in which this order can be seen, include positive imperatives, such as 'Pásamela' (Pass it (e.g. la foto, la botella etc.) to me), as well as negative imperatives 'No me lo pases' (Note: the subjunctive ('pases', from PASAR) is used here as it is a negative command) and at the end of infinitives such as 'Voy a pasártela' (I'm going to pass it to you). In all of these examples the indirect object pronoun preceeds the direct object pronoun.