In Spanish, we have two tenses to express the past tense: the preterite and the imperfect.
The preterite is used to talk about things in the past that have a definite beginning and end. We use preterite to specify an action either at a particular point of time or number of times.
We use the imperfect tense when talking about actions that took place in the past and didn’t have a definite beginning and end. That means that it ndicates that an action took place during a non-specific amount of time or was repeated an indefinite number of times.
For more information: