A federal court on Wednesday ruled that the Internal Revenue Service can serve digital-currency-services company Coinbase with a “John Doe summons” that seeks detailed information on its customers’ transactions from 2013 to 2015.

The IRS and the Justice Department are looking for information about the use of the digital currency bitcoin and the possibility that it has been used to evade federal tax laws over the three-year period. The agencies don’t have any proof of tax evasion, and there is no allegation that Coinbase engaged...