Apple Inc. posted its first holiday-quarter decline in revenue and profit in over a decade and warned the slowdown in its core iPhone business and weakness in China has spilled into this year.

The company’s revenue dropped 4.5% to $84.31 billion for the three months ended Dec. 29, while its profit fell slightly, to $19.97 billion. Apple has been stung at home by smartphone owners’ increasing reluctance to upgrade to pricier devices and by competition in China from lower-priced, feature-rich phones. Its iPhone sales fell 15%...