The National Security Agency collected records about U.S. calls and text messages that it wasn’t authorized to obtain last year, in a second such incident, renewing privacy concerns surrounding the agency’s maligned phone-surveillance program, according to government documents and people familiar with the matter.

The previously undisclosed error, which took place last October, occurred several months after the NSA said it had purged hundreds of millions of metadata records it had amassed since 2015 due to a separate overcollection...