BUENOS AIRES--Mexican billionaire Carlos Slim has acquired an 8.4% stake in YPF SA (YPF, YPFD.BA), Argentina's biggest oil-and-gas company.

Mr. Slim bought 6.59% of YPF's stock, or almost 25.9 million Class D shares, for $288 million, according to a filing YPF sent to the local stock exchange Thursday. He also acquired another 1.77%, or almost seven million shares, as part of the deal.

The Mexican investor obtained the stake through Grupo Financiero Inbursa SAB de CV (GPFOY, GFINBUR.MX).

The shares previously belonged to Argentina's Eskenazi family, which owned 25.46% of YPF through Petersen Energia SA.

The family lost control of those shares as a result of the Argentine government's expropriation last month of 51% of YPF from its majority shareholder, Spain's Repsol YPF SA (REP.MC, REPYY).

The nationalization forced Petersen Energia to give up all of its shares as part of a previous deal with banks, which had helped lend the family enough money to buy the stocks.

YPF's shares in New York jumped 8.1% in after-hours trading Thursday. During Thursday's session, the stock closed up 1.9% at $10.45.

The stock-exchange filing said Slim has no plans to acquire more shares or obtain more control over YPF.

Mr. Slim is the world's richest man, with a net value of around $69 billion, according to a ranking by Forbes magazine.

Write to Taos Turner at taos.turner@dowjones.com