Since you're an English speaker, I'm going to explain this in your language.
The pretérito imperfeito indicates that something was done in the past for an uncertain period of time, but it lasted long. Sometimes it's used to indicate the action interferes in the future.
- Ele era espanhol. - He was Spanish. But he still is. You cannot say "ele foi espanhol".
The pretérito imperfeito is also used to tell you that something was a habit. You did that many times in the past (you don't know how many times, though) whereas the prérito perfeito indicates you did that only once or that you know how many times you did that.
- Eu comia maçãs todos os dias. I used to eat apples everyday.
- Ela gostava de ir à praia quando era jovem. She used to like going to the beach when she was young.
- Nós víamos este filme várias vezes. - We used to watch this movie many times. (habit)
- Nós vimos este filme várias/três vezes. - We watched this movie many/three times.
Furthermore:
- Tu sorrias enquanto cantavas. You were smiling (during the whole song) while you were singing.
- Tu sorriste enquanto cantavas. You smiled (probably once) while you were singing.
The pretérito imperfeito can also be used to express that the action was happening meanwhile something else was being done. See that "enquanto cantavas" is in the pretérito imperfeito because it was a simultaneous action.
When the sentence is in the "Present Perfect" in English, it must be translated as the pretérito perfeito.
- I've never heard of this before. Nunca ouvi falar disso antes.
- Have you already done your homework? Tu já fizeste teu dever de casa?
And finally, the pretérito mais-que-perfeito is used when the action happened before another action in the past. It's used the same way the "Past perfect" is used in English.
- Ele me deu o livro que comprara há vários anos atrás.
- He gave me the book he had bought many years ago.
I hope you understood what I meant.