WASHINGTON—The director of the National Security Agency on Tuesday mounted his most vigorous defense of two controversial data-surveillance programs, saying they helped thwart more than 50 terror plots and contending the agency might have been able to prevent the Sept. 11, 2001, attacks had it had such capabilities.

Testifying before a mostly receptive House Intelligence Committee, Gen. Keith Alexander, flanked by four other top government officials, said the programs have helped the U.S. stave off another major attack on its...