BUENOS AIRES — Trying to put the brakes on a financial crisis that has engulfed Argentina in recent weeks, President Mauricio Macri imposed new restrictions on access to foreign currency.

The restrictions, which took effect Monday, are a remarkable about-face for Mr. Macri, who came into office promising to open up the economy but is instead putting in place the types of measures he has long criticized as he heads into October’s presidential election.

His move reflects just how much Argentina’s economy has gone into a tailspin in the weeks since a nationwide primary last month, in anticipation of the presidential election, yielded a surprising result: The main opposition candidate, Alberto Fernández, had a surprisingly strong showing over Mr. Macri.

Mr. Fernández is running on a ticket with the former president, Cristina Fernández de Kirchner, as his vice president. Investors fear that if he wins the October election it would amount to a return to the interventionist economic policies that came to mark her back-to-back administrations from 2007 to 2015.