Whether or not an out-of-court statement is hearsay depends on the purpose for which it is offered. If it is offered to prove the truth of the matter, it is hearsay. If offered only to impeach (i.e., discredit) a witness, then it is by definition not hearsay.
Cross-examination is the questioning of a witness at a trial or hearing by the opposing party. Impeachment — the discrediting of a witness — is an important component of cross-examination.
Say, for example, that a witness for the government testifies at trial that the light was red at the time of the accident. At an earlier hearing, the witness admitted under oath that she was distracted by other things and did not really get a good look. If the defense seeks to confront her with this earlier testimony, this would be simple impeachment. The testimony is not being introduced to prove the truth of the matter asserted (that is, whether the light was red or green). Instead, the testimony is being used to show that the witness’ testimony at trial is unreliable: She does not know if the light was red or green. This is not hearsay.
By contrast, assume the defense seeks to introduce earlier sworn testimony by the witness that the light had been green at the time of the accident. In this case, the defense not only wants to show that the witness is a liar through impeachment, it also wants to introduce the former statement as substantive evidence proving that the light was in fact green. Because the evidence is being offered for the truth of the matter asserted, it now meets the definition of hearsay. It would therefore need to satisfy the requirements of a hearsay exception – “prior recorded testimony” in this case – in order to be admitted.