Sequence of tenses (known in Latin as consecutio temporum, and also known as agreement of tenses, succession of tenses and tense harmony) is a set of grammatical rules of a particular language, governing the agreement between the tenses of verbs in related clauses or sentences.
A typical context in which rules of sequence of tenses apply is that of indirect speech. If, at some past time, someone spoke a sentence in a particular tense (say the present tense), and that act of speaking is now being reported, the tense used in the clause that corresponds to the words spoken may or may not be the same as the tense that was used by the original speaker. In some languages the tense tends to be "shifted back", so that what was originally spoken in the present tense is reported using the past tense (since what was in the present at the time of the original sentence is in the past relative to the time of reporting). English is one of the languages in which this often occurs. For example, if someone said "I need a drink", this may be reported in the form "She said she needed a drink", with the tense of the verb need changed from present to past.
The "shifting back" of tense as described in the previous paragraph may be called backshifting or an attracted sequence of tenses. In languages and contexts where such a shift does not occur, there may be said by contrast to be a natural sequence.
In English, an attracted sequence of tenses (backshifting) is often used in indirect speech and similar contexts. The attracted sequence can be summarized as follows: If the main verb of a sentence is in the past tense, then other verbs must also express a past viewpoint, except when a general truth is being expressed.
For example, if Batman spoke the following words:
the speech act may be reported using the following words:
with the present tense need replaced by the past tense needed, since the main verb of saying (said) is in the past tense. Further examples can be found at Uses of English verb forms § Indirect speech.