Amazon.com Inc. doesn’t plan to pay the IRS anything this tax season. Yet that’s not largely because of President Donald Trump’s tax overhaul.

The world’s largest retailer simply took advantage of long-standing, low-profile tax deductions. It paid its employees in stock, built new warehouses and tapped tax breaks from when the company wasn’t profitable.

Amazon’s projected $129 million refund highlights how companies can harness the complexities of the U.S. tax code for their own benefit. As a tech company with highly appreciated stock that also relies on brick-and-mortar fulfillment centers and shipping hubs, Amazon is uniquely situated to use the...