HONG KONG — The Apple iPhone transformed the technology industry by popularizing the smartphone and blazing a path to a mobile future. But to do it, the company needed an important ally: a penny-pinching Taiwan-based factory operator named Foxconn.

Employing hundreds of thousands of workers at vast facilities in mainland China, Foxconn figured out a way to assemble the iPhone at a cost low enough that middle-class Americans could afford it. The business offered low profit margins, but the work buffed Foxconn’s financial results and cemented its status as the world’s largest maker of hardware for companies like Apple and Sony.

Those relationships are now shifting — and Foxconn is betting heavily to keep up.

On Wednesday, Foxconn said it had struck a deal to acquire control of the Japanese screen maker Sharp for $3.5 billion, after weeks of negotiations and high-profile setbacks.

The deal, for a 66 percent stake in Sharp, is intended to make Foxconn a more attractive partner for Apple. The American technology company uses Sharp screens, which could give Foxconn added leverage in dealings between the two.