The long-running legal dispute over how much in royalties Apple should pay for using Qualcomm’s patented technology in iPhones came to an end on Tuesday when the two companies agreed to a settlement.

The settlement came a day after a trial in San Diego over the royalties began.

Apple had claimed that Qualcomm had abused its patent-driven dominance to charge excessive royalties. Qualcomm sued Apple for royalties the company’s suppliers were refusing to pay, claiming Apple had interfered with contracts Qualcomm had with companies such as Foxconn. The dispute stretched into courts on three continents. Tuesday’s settlement is reportedly a global agreement that will resolve all those cases.

The agreement could speed the U.S. on the path to a national 5G network. U.S. carriers are building out 5G networks now, enabling faster wireless speeds. But since Qualcomm is the leader in 5G modem technology, the dispute with Apple threatened to slow down the roll-out of 5G phones to consumers.

The settlement could also help Apple and Qualcomm compete against Chinese rival Huawei.

Shares of Qualcomm soared after the news of the settlement was broken by CNBC’s David Faber.