The requests involved 9,000 to 10,000 customer accounts or devices, the company said in a statement on its website. Not all the requests involved the NSA's controversial Prism program, which the company said it did not know about until revelations in the news media on June 6.
The data requests came from federal, state and local authorities and involved national security matters and criminal investigations, Apple said.
"The most common form of request comes from police investigating robberies and other crimes, searching for missing children, trying to locate a patient with Alzheimer's disease, or hoping to prevent a suicide," the statement said.
Apple said some types of data are never provided, including FaceTime conversations and requests made through its Siri voice assistant.
On Friday, Facebook said it received 9,000 to 10,000 government data requests in the second half of 2012, involving 18,000 to 19,000 accounts. The company said it complied with 79% of the requests.
Apple did not provide a compliance percentage.
Apple said its legal team evaluates each request and "from time to time when we see inconsistencies or inaccuracies in a request, we will refuse to fulfill it."
When a request for data is fulfilled, Apple said, the company retrieves and delivers "the narrowest possible set of information" in order to protect the privacy of its customers.
"We will continue to work hard to strike the right balance between fulfilling our legal responsibilities and protecting our customers' privacy as they expect and deserve," Apple said.
Apple doesn't provide some types of information either because the company doesn't retain it or because it is encrypted, the company said.
Customer video calls on FaceTime or text exchanges using iMessage have "end-to-end encryption" and Apple cannot decrypt the data, the company said. Also, Apple said it did not store identifiable data on customer location, map searches or Siri queries.
Apple said in April that it records and stores Siri queries for up to two years. At the time, Apple said it kept for six months Siri data that was associated with specific customers. The data were kept for up to 18 months after that, but identifiable information was removed, it said.