State-owned oil giant Saudi Aramco has raised a record $25.6bn (£19.4bn) in its initial public offering in Riyadh.

The share sale was the biggest to date, surpassing that of China’s Alibaba which raised $25bn in 2014 in New York.

Aramco relied on domestic and regional investors to sell a 1.5% stake after lukewarm interest from abroad.

The IPO will value it at $1.7tn when trading begins – short of its $2tn target, but making it the most valuable listed company in the world.

The share sale is at the heart of Crown Prince Mohammed bin Salman’s plans to modernise the Saudi economy and wean it off its dependence on oil.

The country urgently needs tens of billions of dollars to fund megaprojects and develop new industries.

Aramco has found the journey to its public offering testing.

It initially sought to raise $100bn on two exchanges – with a first listing on the kingdom’s Tadawul bourse, and then another on an overseas exchange such as the London Stock Exchange.

But it scaled back its plans after foreign investors raised concerns about climate change, political risk and a lack of corporate transparency.

International institutions also baulked at the firm’s $1.7tn valuation, prompting Aramco to pull marketing roadshows in New York and London.

Instead, it focused its marketing efforts on Saudi investors and wealthy Gulf Arab allies. Saudi banks also offered citizens cheap credit to bid for the shares following a nationwide advertising campaign.

Shares were priced at 32 Saudi riyals ($8.53) on Thursday and were heavily oversubscribed, according to reports.

But it remains to be seen whether the share price rises or falls when trading begins, most likely later this month.

The IPO’s pricing came as Saudi Arabia met with Russia and other members of the Organization of the Petroleum Exporting Countries (Opec) in Vienna to discuss oil production.

The allies – who together pump 40% of the world’s oil – agreed to deepen output cuts as part of ongoing efforts to prop up global prices.

Oil prices collapsed in mid 2014 and have yet to fully recover, leaving oil-dependent economies under pressure.

The market is struggling with slower global growth and a flood of new production from countries such as the US.