Banks and investors flocked to buy Saudi Arabia’s first global bonds, a milestone in the giant oil producer’s efforts to diversify its economy and embrace global financial markets.

The $17.5 billion sale, the largest-ever debt sale by a developing country, marks a crucial step for the kingdom as it undertakes an ambitious plan to move away from decades of dependence on oil revenue, which has fallen in recent years along with the global crude price, and to accelerate growth in its private sector.

Strong demand for the debt, sold primarily to U.S. investors in a private placement and to Asian institutions, allowed the Saudis to reduce the yields below initial marketing plans while reaching out to an expanding investor base.

The offering attracted about $67 billion in orders, according to one investor familiar with the deal. Five-year bonds paid a yield of about 2.58%, compared with initial guidance of 2.83%. Ten-year notes yielded around 3.4%, and 30-year bonds were priced at 4.62%, both lower than initial guidance.

Wednesday’s sale is the latest in a flurry of efforts to broaden the economy by Saudi officials seeking to close a widening budget gap that the government expects to reach $87 billion this year. The country in April borrowed $10 billion from a group of international banks, its first foreign borrowing in more than a decade. It is preparing to list part of its state oil giant, Saudi Arabian Oil Co., or Aramco, in 2018 and created a new sovereign-wealth fund to invest its reserves more aggressively in hopes of higher returns.