The pretérito perfecto is similar in nature to the English present perfect tense. It is used to describe: actions in the past that have been recently completed. actions in the past that started in the past and are still continuing or seen as the present.
The pretérito indefinido is used to express: a completed action at some point or moment in the past. the beginning or end of an action in the past. an action in the past that interrupts an action that was already taking place (this involves another past tense called imperfecto).