WASHINGTON—The Justice Department secretly kept a database of U.S. calls to and from foreign countries for more than a decade, according to a new court filing and officials familiar with the program.

The revelation of another secret government database storing records of Americans’ calls came in a filing Thursday in the case of a man accused of conspiring to unlawfully export electronic goods to Iran.

A...