When Japan decided to pick a fight with South Korea last month, it dug deep into the supply chain to impose sanctions on three obscure materials made by a handful of Japanese companies few have ever heard of.

The most powerful weapon in Tokyo's campaign against its neighbor turned out to be a half dozen or so niche firms with names like JSR Corp., Shin-Etsu Chemical Co. and Tokyo Ohka Kogyo Co. They make fluorinated polyimide, hydrogen fluoride and photoresist: essential ingredients for the manufacture of the displays and semiconductors that go into every piece of modern consumer electronics, from Apple Inc. iPhones and Dell Technologies Inc. laptops to the full range of Samsung Electronics Co. devices.

How did they become so indispensable? And how did they manage to stay on top even after their Japanese clients ceded the chip and display markets to Taiwanese and South Korean rivals? The answer lies in a series of well-timed investments decades ago, combined with a willingness to explore foreign markets and an unceasing refinement of manufacturing standards too exacting for anyone else to try and match.