Both are past tense, but the duration or repetition of an action is important when deciding which to use. For an action with a definite start and end point, which was completed once, the preterite tense would be most suitable. However, if the action was repeated over a sustained period of time, the imperfect tense would fit better.
For example:"I played football" [on Saturday] would require the preterite - "Jugué fútbol" [el sábado]while"I played football" [when I was younger] would require the imperfect - "Jugaba fútbol" [cuando era joven]Context is the most important determining factor.
You can use the preterite and the imperfect in conjunction with each other to give a fuller description of a past event by saying what was happenning when something else happened.
For example:"I was listening to music when you arrived" - "Escuchaba música cuando llegaste"Escuchar takes the imperfect form as the action had been going on for an unspecified length of time, whereas llegar takes the preterite form as it refers to the completed action which was the interruption.