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.

Related

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.

Buyers cited the appeal of above-average yields for a large, relatively rich country at a time of ultralow global interest rates and soft growth, as well as recent stability in the price of crude oil. Oil prices Wednesday rose 2.6% to $51.60 a barrel on the New York Mercantile Exchange, a one-year high and well above the 13-year low hit earlier this year of less than $30 a barrel.

“This is a huge boost to sentiment,” said Florence Eid-Oakden, chief economist at Arabia Monitor, a London-based research and strategy firm. “They now know they can tap the international market at a reasonable rate and with amounts that are record shattering.”

Yet many analysts and investors remain skeptical of the Saudi turnaround story, which will force the nation to sharply cut subsidies in what could be a difficult economic rebalancing, and many cited lingering questions about the kingdom’s commitment to providing clear information on economic development and investment risks to bond buyers.

Some money managers said they bought in because the giant bond offering will be a significant part of certain global bond indexes. Some Middle Eastern banks that do business with Riyadh also gobbled up bonds, people familiar with matter said.

Marco Santamaria, co-head of the emerging-markets team at AllianceBernstein, said he bought the bonds to pick up yield at a time when interest rates among more stable countries are low or negative.

Others passed, saying the kingdom didn’t offer enough yield for the inherent risks of a country undergoing dramatic change or because they said Saudi officials weren’t sufficiently forthcoming. The Saudi Ministry of Finance didn’t respond to a request for comment.

The kingdom is trying to wean itself away from crude and create new jobs for a fast-growing young population in a country that has long depended on government spending and cheap foreign labor.

Saudi Arabia’s fiscal deficit widened to about 16% of nominal gross domestic product in 2015, as oil income tumbled. With income from crude exports accounting for nearly three-quarters of government revenue, the kingdom posted a record deficit of $98 billion last year. It is also embroiled in costly conflicts in Yemen and Syria.

Saudi Arabia’s plan to overhaul the economy has been dubbed Vision 2030 and is led by Deputy Crown Prince Mohammed bin Salman, a 31-year-old son of the king. It calls for giving the kingdom access to different sources of financing and relaxing rules on investment to attract foreign investors to the Saudi stock market.

Beyond the borrowing and Aramco sale, Saudi officials have taken other steps. Japanese technology company
SoftBank Group Corp.
said this month it is teaming with Saudi Arabia to create an investment fund with plans to invest as much as $100 billion in tech companies, part of the kingdom’s effort to lessen its dependence on oil.

Even on the energy front, Saudi Arabia is trying to diversify. Khalid al-Falih, Saudi energy minister and chairman of Aramco, said at a London industry conference Wednesday that the state oil company plans to boost its refining and chemicals business and expand into cleaner energy such as nuclear power.

The sale surpasses a $16.5 billion bond offering that Argentina sold earlier this year, a record at the time for a developing country. Investors buying those bonds cited a belief in Argentina’s promise as an economic turnaround story. Argentina sold bonds between three years to 30 years, with the benchmark 10-year note yielding at 7.5%.

Amy Kam, an investment manager at
GAM Holding
in London, said there are early signs of Saudi Arabia diversifying its economy, but there have yet to be material changes.

She placed orders for the five-year bonds because the recent discussions among members of the Organization of the Petroleum Exporting Countries about a production cut gave her the “expectation there could be some stability” in crude prices.

Some investors said Saudi efforts to curb its budget deficit and limit public spending didn’t carry over to the bond’s roadshow. Some officials flew into the U.S. on private jets and held a glitzy luncheon event at Manhattan’s luxury St. Regis hotel, according to investors who attended the event.`

Richard House, head of emerging-market debt at Standard Life Investments in London, said he didn’t buy the Saudi bonds because he thought the price was too high. But he also said he left roadshow meetings with Saudi officials uncertain how the economic plan would work.

“It’s hard not to believe their intentions,” Mr. House said. “How they go about doing it, they weren’t really that clear.”