When talking about the past, we sometimes refer to things that had happened previously. In English, you often use had followed by a past participle such as spoken, eaten, lived or been to do this. This tense is known as the pluperfect or past perfect tense.
The Spanish pluperfect tense or pretérito pluscuamperfecto is used and formed in a similar way.
Ya habíamos comido cuando Pedro llegó. (We’d already eaten when Peter arrived.)
Nunca lo había visto antes de aquella noche. (I’d never seen it before that night.)
Aprobó el examen porque había estudiado mucho. (He passed the exam because he had studied a lot.)