In a nationwide primary, Mr. Macri received 32% support versus 47% for his opponent, Alberto Fernandez, with more than 80% of the ballots counted, the government said. Mr. Fernandez is a member of the powerful Peronist movement whose vice presidential running mate is ex-President Cristina Kirchner, the firebrand nationalist. Many Argentines believe Mrs. Kirchner is calling the shots for the opposition.
“We had a bad election,” Mr. Macri told supporters late Sunday. “It hurts that we didn’t receive the support that we hoped for.”
The outcome of the vote could stoke volatility in Latin America’s third-biggest economy weeks after Argentina and three other South American countries reached a trade deal with the European Union that would open up Argentina’s economy, one of the most closed in the world. Mr. Fernandez has criticized the pact as a deathblow to Argentina’s protected industry.
During her eight-year term that ended in 2015, Mrs. Kirchner nationalized businesses, implemented price controls and defaulted on Argentina’s debt. Her administration was marred by corruption scandals, with Mrs. Kirchner now facing trial on graft charges, which she denies.
“We can’t return to the past,” Mr. Macri said at a rally last week in Argentina’s second-largest city, Córdoba. “Imagine for an instant everything that we can do in the next four years with a little bit of wind in our favor and the bases that we’ve built…. We have to keep transforming Argentina.”
Pollsters expected Mr. Fernandez to get more votes than Mr. Macri on Sunday, but the government hoped to keep the gap to within 5 percentage points, close enough to close by October’s presidential election. They were also hoping Mr. Fernandez wouldn’t finish near 45% support, the threshold needed to win outright in October and avoid a second-round runoff.
The primary is mandatory for voters and pits all candidates against each other, with those achieving at least 1.5% of the vote deemed eligible to run in October’s presidential election. It provides a strong indication of voter preferences ahead of the election.
The poor showing by the president could spark selling of Argentina’s currency that would push inflation higher and fuel more discontent, said Matias Carugati, head economist at Buenos Aires-based pollster Management & Fit.
“Things will be even harder for Macri,” said Mr. Carugati. “It will be complicated for the central bank to keep things under control.”
The government also suffered a big defeat in the primary for governor in the voter-rich province of Buenos Aires, which has nearly 40% of the country’s electorate. Axel Kicillof, a former finance minister under Mrs. Kirchner, received 49% of the votes versus 33% for Gov. María Eugenia Vidal, a close ally of Mr. Macri.
“We’re going to build a different country,” said Mr. Fernandez to supporters cheering “Alberto Presidente.”
Mr. Macri, who was elected in 2015 with 51% of the vote on promises to slash inflation and jump-start economic growth, has seen his support tumble over the past year as the economy sank into recession and inflation accelerated on a sharp depreciation of the peso.
To cope with the currency crisis, the government received a $57 billion bailout last year from the International Monetary Fund, the fund’s largest ever. Unemployment and poverty increased over the past year as businesses closed.
In June, inflation was at 56%, among the world’s highest.
In recent months, however, the president’s support has recovered slightly as the economy has begun to show signs of improvement, with inflation easing.
In May, the economy expanded for the first time in more than a year as soybean farmers had a strong crop.
Mr. Macri says he needs more time to turn around an economy that he says was mismanaged for years by Mrs. Kirchner and her late husband and predecessor, Néstor Kirchner.
He warns that electing his rival would jeopardize the base his administration has built for a strong economy by cutting taxes, investing in infrastructure and opening Argentina more to trade.
Mr. Fernandez criticizes Mr. Macri’s economic stewardship. He points to Argentina’s growing debt, the surge in inflation and loss of jobs.
He promises to strengthen local industry, protect worker rights in a country with powerful unions and invest in health care.
“The only thing they know how to produce is poverty,” Mr. Fernandez told supporters. “We have to start to change history. We deserve to live in a better country.”
Many Argentines are unhappy with both campaigns.
In one poll, the most popular word Argentines used to describe Mr. Macri was useless.
The top word for Mrs. Kirchner was corrupt. For Mr. Fernandez, who once criticized his running mate, it was flip-flopper.
The poll “describes the climate of sorrow and anger,” said Jorge Giacobbe, a political analyst whose firm conducted the poll. “There is a complete lack of hope.”
Americo Beltrame, a 57-year-old vegetable seller in Buenos Aires, supports Mr. Fernandez, saying he can’t imagine another four years with Mr. Macri.
He said he was struggling to get by as customers cut back on spending to cope with rising costs.
“Macri blew up the middle class with the increase in utility prices, inflation that doesn’t stop and unemployment,” said Mr. Beltrame. “No one has enough to live with dignity. We can’t bear this anymore.”
Juan Carlos Mareque, a 55-year-old farmer, wanted Mr. Macri to win. He benefited after the government lifted currency controls and removed some farm export taxes. He is confident that more jobs will be created if Mr. Macri is re-elected.
“We’ve got to give him another chance so that in the next four years the quality of life of all Argentines improves,” said Mr. Mareque.
—Alberto Messer
contributed to this article.